def save_preimage(self, payment_hash: bytes, preimage: bytes):
    assert (sha256(preimage) == payment_hash)
    self.preimages[bh2u(payment_hash)] = bh2u(preimage)
    self.wallet.save_db()
def save_preimage(self, payment_hash: bytes, preimage: bytes):
    assert (sha256(preimage) == payment_hash)
    self.preimages[bh2u(payment_hash)] = bh2u(preimage)
    self.wallet.save_db()