def get_preimage(self, payment_hash: bytes) -> Optional[bytes]:
    r = self.preimages.get(bh2u(payment_hash))
    return (bfh(r) if r else None)
def get_preimage(self, payment_hash: bytes) -> Optional[bytes]:
    r = self.preimages.get(bh2u(payment_hash))
    return (bfh(r) if r else None)