mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-23 20:36:44 +00:00
when importing electrum wallets retrieve tx labels from address labels
This commit is contained in:
parent
497cf333b0
commit
9600d5707c
1 changed files with 17 additions and 3 deletions
|
@ -10,9 +10,7 @@ import com.sparrowwallet.drongo.address.Address;
|
|||
import com.sparrowwallet.drongo.crypto.*;
|
||||
import com.sparrowwallet.drongo.policy.Policy;
|
||||
import com.sparrowwallet.drongo.policy.PolicyType;
|
||||
import com.sparrowwallet.drongo.protocol.ScriptType;
|
||||
import com.sparrowwallet.drongo.protocol.Sha256Hash;
|
||||
import com.sparrowwallet.drongo.protocol.Transaction;
|
||||
import com.sparrowwallet.drongo.protocol.*;
|
||||
import com.sparrowwallet.drongo.wallet.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -233,6 +231,22 @@ public class Electrum implements KeystoreFileImport, WalletImport, WalletExport
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(BlockTransaction blkTx : ew.transactions.values()) {
|
||||
if(blkTx.getLabel() == null) {
|
||||
Transaction tx = blkTx.getTransaction();
|
||||
for(TransactionOutput txOutput : tx.getOutputs()) {
|
||||
try {
|
||||
Address[] addresses = txOutput.getScript().getToAddresses();
|
||||
if(Arrays.asList(addresses).contains(address)) {
|
||||
blkTx.setLabel(ew.labels.get(key));
|
||||
}
|
||||
} catch(NonStandardScriptException ex) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
//not an address
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue