mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
check change address diversifier on spark address generate
This commit is contained in:
parent
555448a0e9
commit
07b21a42c6
1 changed files with 6 additions and 4 deletions
|
@ -23,8 +23,6 @@ const kDefaultSparkIndex = 1;
|
|||
// TODO dart style constants. Maybe move to spark lib?
|
||||
const MAX_STANDARD_TX_WEIGHT = 400000;
|
||||
|
||||
const SPARK_CHANGE_D = 0x270F;
|
||||
|
||||
//https://github.com/firoorg/sparkmobile/blob/ef2e39aae18ecc49e0ddc63a3183e9764b96012e/include/spark.h#L16
|
||||
const SPARK_OUT_LIMIT_PER_TX = 16;
|
||||
|
||||
|
@ -70,7 +68,7 @@ mixin SparkInterface on Bip39HDWallet, ElectrumXInterface {
|
|||
_sparkChangeAddressCached = await LibSpark.getAddress(
|
||||
privateKey: keys.privateKey.data,
|
||||
index: kDefaultSparkIndex,
|
||||
diversifier: SPARK_CHANGE_D,
|
||||
diversifier: kSparkChange,
|
||||
isTestNet: cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
);
|
||||
}
|
||||
|
@ -116,7 +114,11 @@ mixin SparkInterface on Bip39HDWallet, ElectrumXInterface {
|
|||
(await getCurrentReceivingSparkAddress())?.derivationIndex;
|
||||
|
||||
// default to starting at 1 if none found
|
||||
final int diversifier = (highestStoredDiversifier ?? 0) + 1;
|
||||
int diversifier = (highestStoredDiversifier ?? 0) + 1;
|
||||
// change address check
|
||||
if (diversifier == kSparkChange) {
|
||||
diversifier++;
|
||||
}
|
||||
|
||||
final root = await getRootHDNode();
|
||||
final String derivationPath;
|
||||
|
|
Loading…
Reference in a new issue