From 4cbb582917f5542555db48ae8cf3fdc165a083d6 Mon Sep 17 00:00:00 2001 From: Wenfeng Wang Date: Tue, 28 Apr 2020 04:02:52 +0000 Subject: [PATCH] Add BTG hashType definition into enum TWBitcoinSigHashType --- include/TrustWalletCore/TWBitcoinSigHashType.h | 1 + tests/BitcoinGold/TWBitcoinGoldTests.cpp | 2 +- tests/BitcoinGold/TWSignerTests.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/TrustWalletCore/TWBitcoinSigHashType.h b/include/TrustWalletCore/TWBitcoinSigHashType.h index 1ed7d7c0e4c..33fba1992d2 100644 --- a/include/TrustWalletCore/TWBitcoinSigHashType.h +++ b/include/TrustWalletCore/TWBitcoinSigHashType.h @@ -16,6 +16,7 @@ enum TWBitcoinSigHashType { TWBitcoinSigHashTypeNone = 0x02, TWBitcoinSigHashTypeSingle = 0x03, TWBitcoinSigHashTypeFork = 0x40, + TWBitcoinSigHashTypeForkBTG = 0x4f40, TWBitcoinSigHashTypeAnyoneCanPay = 0x80 }; diff --git a/tests/BitcoinGold/TWBitcoinGoldTests.cpp b/tests/BitcoinGold/TWBitcoinGoldTests.cpp index 39636277196..1d5c2bf84f9 100644 --- a/tests/BitcoinGold/TWBitcoinGoldTests.cpp +++ b/tests/BitcoinGold/TWBitcoinGoldTests.cpp @@ -69,7 +69,7 @@ TEST(TWBitcoinGoldTxGeneration, TxGeneration) { // Setup input Proto::SigningInput input; input.set_coin_type(TWCoinTypeBitcoinGold); - input.set_hash_type(TWBitcoinSigHashTypeFork | TWBitcoinSigHashTypeAll | (79 << 8)); + input.set_hash_type(TWBitcoinSigHashTypeAll | TWBitcoinSigHashTypeForkBTG); input.set_amount(amount); input.set_byte_fee(1); input.set_to_address("btg1qmd6x5awe4t5fjhgntv0pngzdwajjg250wxdcs0"); diff --git a/tests/BitcoinGold/TWSignerTests.cpp b/tests/BitcoinGold/TWSignerTests.cpp index 19abc521089..86df4466577 100644 --- a/tests/BitcoinGold/TWSignerTests.cpp +++ b/tests/BitcoinGold/TWSignerTests.cpp @@ -28,7 +28,7 @@ TEST(TWBitcoinGoldSigner, SignTransaction) { // Setup input Proto::SigningInput input; input.set_coin_type(TWCoinTypeBitcoinGold); - input.set_hash_type(TWBitcoinSigHashTypeFork | TWBitcoinSigHashTypeAll | (79 << 8)); + input.set_hash_type(TWBitcoinSigHashTypeAll | TWBitcoinSigHashTypeForkBTG); input.set_amount(amount); input.set_byte_fee(1); input.set_to_address("btg1qmd6x5awe4t5fjhgntv0pngzdwajjg250wxdcs0");