WIP: ldk improv

This commit is contained in:
Overtorment 2021-11-03 12:10:57 +00:00
parent 4e677650b5
commit 3046b8e6ef
5 changed files with 10 additions and 8 deletions

View file

@ -138,7 +138,8 @@ export default class SyncedAsyncStorage {
if (+remoteSeqNum > +localSeqNum) {
console.log('remote storage is ahead, need to sync;', +remoteSeqNum, '>', +localSeqNum);
for (const key of await this.getAllKeysRemote()) {
// sort to ensure channel_manager comes first
for (const key of (await this.getAllKeysRemote()).sort()) {
const value = await this.getItemRemote(key);
await AsyncStorage.setItem(this.namespace + '_' + key, value);
console.log('synced', key, 'to', value);

View file

@ -60,10 +60,6 @@ export class LightningLdkWallet extends LightningCustodianWallet {
return false;
}
async start(entropyHex: string) {
return RnLdk.start(entropyHex);
}
async stop() {
return RnLdk.stop();
}
@ -233,6 +229,10 @@ export class LightningLdkWallet extends LightningCustodianWallet {
return ret;
}
getStorageNamespace() {
return RnLdk.getStorage().namespace;
}
static async _decodeInvoice(invoice: string) {
return bolt11.decode(invoice);
}

4
package-lock.json generated
View file

@ -20924,8 +20924,8 @@
}
},
"rn-ldk": {
"version": "git+https://github.com/BlueWallet/rn-ldk.git#v0.6.0",
"from": "git+https://github.com/BlueWallet/rn-ldk.git#v0.6.0"
"version": "git+https://github.com/BlueWallet/rn-ldk.git#v0.6.1",
"from": "git+https://github.com/BlueWallet/rn-ldk.git#v0.6.1"
},
"rn-nodeify": {
"version": "10.3.0",

View file

@ -189,7 +189,7 @@
"react-test-render": "1.1.2",
"readable-stream": "3.6.0",
"realm": "10.9.1",
"rn-ldk": "git+https://github.com/BlueWallet/rn-ldk.git#v0.6.0",
"rn-ldk": "git+https://github.com/BlueWallet/rn-ldk.git#v0.6.1",
"rn-nodeify": "10.3.0",
"scryptsy": "2.1.0",
"secure-random": "1.1.2",

View file

@ -91,6 +91,7 @@ const LdkViewLogs = () => {
let nfo = 'num peers: ' + peers.length;
nfo += '\nnum channels: ' + listChannels.length;
nfo += '\nldk binary version: ' + version;
nfo += '\nstorage namespace: ' + wallet.getStorageNamespace();
setInfo(nfo);
})
.finally(() => {