mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 18:44:31 +00:00
fix: Handle sent to self transactions when sent to a change address
This commit is contained in:
parent
3d5e86dc6f
commit
74d3175d87
1 changed files with 24 additions and 12 deletions
|
@ -148,19 +148,31 @@ mixin ElectrumXParsing {
|
||||||
type = TransactionType.outgoing;
|
type = TransactionType.outgoing;
|
||||||
amount = amountSentFromWallet - changeAmount - fee;
|
amount = amountSentFromWallet - changeAmount - fee;
|
||||||
|
|
||||||
final possible =
|
// non wallet addresses found in tx outputs
|
||||||
outputAddresses.difference(myChangeReceivedOnAddresses).first;
|
final nonWalletOutAddresses = outputAddresses.difference(
|
||||||
|
myChangeReceivedOnAddresses,
|
||||||
|
);
|
||||||
|
|
||||||
if (transactionAddress.value != possible) {
|
if (nonWalletOutAddresses.isNotEmpty) {
|
||||||
transactionAddress = Address(
|
final possible = nonWalletOutAddresses.first;
|
||||||
walletId: walletId,
|
|
||||||
value: possible,
|
if (transactionAddress.value != possible) {
|
||||||
derivationIndex: -1,
|
transactionAddress = Address(
|
||||||
derivationPath: null,
|
walletId: walletId,
|
||||||
subType: AddressSubType.nonWallet,
|
value: possible,
|
||||||
type: AddressType.nonWallet,
|
derivationIndex: -1,
|
||||||
publicKey: [],
|
derivationPath: null,
|
||||||
);
|
subType: AddressSubType.nonWallet,
|
||||||
|
type: AddressType.nonWallet,
|
||||||
|
publicKey: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// some other type of tx where the receiving address is
|
||||||
|
// one of my change addresses
|
||||||
|
|
||||||
|
type = TransactionType.sentToSelf;
|
||||||
|
amount = changeAmount;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// incoming tx
|
// incoming tx
|
||||||
|
|
Loading…
Reference in a new issue