forked from Blockstream/lwk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom_persister.py
34 lines (23 loc) · 947 Bytes
/
custom_persister.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from lwk import *
class PythonPersister(ForeignPersister):
data = []
def get(self, i):
try:
return self.data[i]
except:
None
def push(self, update):
self.data.append(update)
desc = WolletDescriptor("ct(slip77(ab5824f4477b4ebb00a132adfd8eb0b7935cf24f6ac151add5d1913db374ce92),elwpkh([759db348/84'/1'/0']tpubDCRMaF33e44pcJj534LXVhFbHibPbJ5vuLhSSPFAw57kYURv4tzXFL6LSnd78bkjqdmE3USedkbpXJUPA1tdzKfuYSL7PianceqAhwL2UkA/<0;1>/*))#cch6wrnp");
network = Network.testnet()
assert(str(network) == "LiquidTestnet")
client = network.default_electrum_client()
persister = ForeignPersisterLink(PythonPersister())
wollet = Wollet.with_custom_persister(network, desc, persister)
update = client.full_scan(wollet)
wollet.apply_update(update)
total_txs = len(wollet.transactions())
assert(total_txs >= 11)
wollet = None
w2 = Wollet.with_custom_persister(network, desc, persister)
assert(total_txs == len(w2.transactions()))