Browse Source

lnwatcher: store transactions as binary

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
ThomasV 6 years ago
parent
commit
02d013421a
  1. 1
      electrum/lnrouter.py
  2. 4
      electrum/lnwatcher.py

1
electrum/lnrouter.py

@ -219,7 +219,6 @@ class ChannelDB(SqlDB):
def __init__(self, network: 'Network'):
path = os.path.join(get_headers_dir(network.config), 'channel_db')
super().__init__(network, path, Base)
print(Base)
self.num_nodes = 0
self.num_channels = 0
self._channel_updates_for_private_channels = {} # type: Dict[Tuple[bytes, bytes], dict]

4
electrum/lnwatcher.py

@ -65,7 +65,7 @@ class SweepStore(SqlDB):
@sql
def get_sweep_tx(self, funding_outpoint, prev_txid):
return [Transaction(r.tx) for r in self.DBSession.query(SweepTx).filter(SweepTx.funding_outpoint==funding_outpoint, SweepTx.prev_txid==prev_txid).all()]
return [Transaction(bh2u(r.tx)) for r in self.DBSession.query(SweepTx).filter(SweepTx.funding_outpoint==funding_outpoint, SweepTx.prev_txid==prev_txid).all()]
@sql
def list_sweep_tx(self):
@ -73,7 +73,7 @@ class SweepStore(SqlDB):
@sql
def add_sweep_tx(self, funding_outpoint, prev_txid, tx):
self.DBSession.add(SweepTx(funding_outpoint=funding_outpoint, prev_txid=prev_txid, tx=str(tx), txid=tx.txid()))
self.DBSession.add(SweepTx(funding_outpoint=funding_outpoint, prev_txid=prev_txid, tx=bfh(str(tx)), txid=tx.txid()))
self.DBSession.commit()
@sql

Loading…
Cancel
Save