1
0

create sweep transaction outside of lnwatcher

This commit is contained in:
ThomasV
2018-10-05 19:37:55 +02:00
parent 72eb179c7a
commit 11c3ca281c
5 changed files with 201 additions and 225 deletions

View File

@@ -543,3 +543,20 @@ class LnKeyFamily(IntEnum):
def generate_keypair(ln_keystore: BIP32_KeyStore, key_family: LnKeyFamily, index: int) -> Keypair:
return Keypair(*ln_keystore.get_keypair([key_family, 0, index], None))
from typing import Optional
class EncumberedTransaction(NamedTuple("EncumberedTransaction", [('tx', Transaction),
('csv_delay', Optional[int])])):
def to_json(self) -> dict:
return {
'tx': str(self.tx),
'csv_delay': self.csv_delay,
}
@classmethod
def from_json(cls, d: dict):
d2 = dict(d)
d2['tx'] = Transaction(d['tx'])
return EncumberedTransaction(**d2)