mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-05 05:46:44 +00:00
handle concurrent modifications when saving address nodes
This commit is contained in:
parent
ceb5d85648
commit
f0a813d031
1 changed files with 3 additions and 1 deletions
|
@ -11,6 +11,7 @@ import org.jdbi.v3.sqlobject.statement.SqlQuery;
|
||||||
import org.jdbi.v3.sqlobject.statement.SqlUpdate;
|
import org.jdbi.v3.sqlobject.statement.SqlUpdate;
|
||||||
import org.jdbi.v3.sqlobject.statement.UseRowReducer;
|
import org.jdbi.v3.sqlobject.statement.UseRowReducer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -60,7 +61,8 @@ public interface WalletNodeDao {
|
||||||
for(WalletNode purposeNode : wallet.getPurposeNodes()) {
|
for(WalletNode purposeNode : wallet.getPurposeNodes()) {
|
||||||
long purposeNodeId = insertWalletNode(purposeNode.getDerivationPath(), truncate(purposeNode.getLabel()), wallet.getId(), null);
|
long purposeNodeId = insertWalletNode(purposeNode.getDerivationPath(), truncate(purposeNode.getLabel()), wallet.getId(), null);
|
||||||
purposeNode.setId(purposeNodeId);
|
purposeNode.setId(purposeNodeId);
|
||||||
for(WalletNode addressNode : purposeNode.getChildren()) {
|
List<WalletNode> childNodes = new ArrayList<>(purposeNode.getChildren());
|
||||||
|
for(WalletNode addressNode : childNodes) {
|
||||||
long addressNodeId = insertWalletNode(addressNode.getDerivationPath(), truncate(addressNode.getLabel()), wallet.getId(), purposeNodeId);
|
long addressNodeId = insertWalletNode(addressNode.getDerivationPath(), truncate(addressNode.getLabel()), wallet.getId(), purposeNodeId);
|
||||||
addressNode.setId(addressNodeId);
|
addressNode.setId(addressNodeId);
|
||||||
addTransactionOutputs(addressNode);
|
addTransactionOutputs(addressNode);
|
||||||
|
|
Loading…
Reference in a new issue