mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-12-26 18:16:45 +00:00
fix off by one bug
This commit is contained in:
parent
66d4e11bf6
commit
2e1012da8b
1 changed files with 5 additions and 5 deletions
|
@ -101,18 +101,18 @@ public class Wallet {
|
|||
purposeNode = optionalPurposeNode.get();
|
||||
}
|
||||
|
||||
purposeNode.fillToIndex(getLookAhead(purposeNode));
|
||||
purposeNode.fillToIndex(getLookAheadIndex(purposeNode));
|
||||
return purposeNode;
|
||||
}
|
||||
|
||||
public int getLookAhead(WalletNode node) {
|
||||
int lookAhead = DEFAULT_LOOKAHEAD;
|
||||
public int getLookAheadIndex(WalletNode node) {
|
||||
int lookAheadIndex = DEFAULT_LOOKAHEAD - 1;
|
||||
Integer highestUsed = node.getHighestUsedIndex();
|
||||
if(highestUsed != null) {
|
||||
lookAhead = highestUsed + lookAhead;
|
||||
lookAheadIndex = highestUsed + DEFAULT_LOOKAHEAD;
|
||||
}
|
||||
|
||||
return lookAhead;
|
||||
return lookAheadIndex;
|
||||
}
|
||||
|
||||
public WalletNode getFreshNode(KeyPurpose keyPurpose) {
|
||||
|
|
Loading…
Reference in a new issue