Browse Source

Litecoin: Fix tests

0.16
Adrian Gallagher 7 years ago
parent
commit
32ee7c79ae
No known key found for this signature in database
GPG Key ID: FE3348877809386C
  1. 1
      src/Makefile.test.include
  2. 3
      src/bench/checkblock.cpp
  3. BIN
      src/bench/data/block413567.raw
  4. 2
      src/qt/test/test_main.cpp
  5. 2
      src/qt/test/wallettests.cpp
  6. 2
      src/test/amount_tests.cpp
  7. 234
      src/test/data/base58_keys_valid.json
  8. 2
      src/test/test_bitcoin_main.cpp
  9. 2
      src/wallet/test/wallet_tests.cpp
  10. 20
      test/functional/feature_block.py
  11. 9
      test/functional/feature_cltv.py
  12. 2
      test/functional/feature_config_args.py
  13. 21
      test/functional/feature_csv_activation.py
  14. 7
      test/functional/feature_dersig.py
  15. 6
      test/functional/interface_bitcoin_cli.py
  16. 2
      test/functional/interface_zmq.py
  17. 2
      test/functional/mempool_persist.py
  18. 1
      test/functional/p2p_fingerprint.py
  19. 4
      test/functional/p2p_invalid_block.py
  20. 2
      test/functional/p2p_invalid_tx.py
  21. 8
      test/functional/p2p_sendheaders.py
  22. 14
      test/functional/p2p_unrequested_blocks.py
  23. 2
      test/functional/rpc_rawtransaction.py
  24. 2
      test/functional/rpc_signmessage.py
  25. 2
      test/functional/test_framework/address.py
  26. 2
      test/functional/test_framework/coverage.py
  27. 12
      test/functional/test_framework/messages.py
  28. 6
      test/functional/test_framework/mininode.py
  29. 40
      test/functional/test_framework/test_framework.py
  30. 10
      test/functional/test_framework/test_node.py
  31. 16
      test/functional/test_runner.py
  32. 6
      test/util/data/bitcoin-util-test.json
  33. 4
      test/util/data/txcreatemultisig1.json
  34. 2
      test/util/data/txcreatemultisig2.json
  35. 2
      test/util/data/txcreatemultisig3.json
  36. 2
      test/util/data/txcreatemultisig4.json
  37. 2
      test/util/data/txcreateoutpubkey2.json
  38. 2
      test/util/data/txcreateoutpubkey3.json
  39. 2
      test/util/data/txcreatescript2.json
  40. 2
      test/util/data/txcreatescript3.json
  41. 2
      test/util/data/txcreatescript4.json
  42. 4
      test/util/data/txcreatesignv1.json

1
src/Makefile.test.include

@ -34,7 +34,6 @@ BITCOIN_TESTS =\ @@ -34,7 +34,6 @@ BITCOIN_TESTS =\
test/bech32_tests.cpp \
test/bip32_tests.cpp \
test/blockchain_tests.cpp \
test/blockencodings_tests.cpp \
test/bloom_tests.cpp \
test/bswap_tests.cpp \
test/checkqueue_tests.cpp \

3
src/bench/checkblock.cpp

@ -17,6 +17,9 @@ namespace block_bench { @@ -17,6 +17,9 @@ namespace block_bench {
// a block off the wire, but before we can relay the block on to peers using
// compact block relay.
// Litecoin uses block height 878439, hash 0babe680f55a55d54339511226755f0837261da89a4e78eba4d6436a63026df8
// which contains 3808 transactions.
static void DeserializeBlockTest(benchmark::State& state)
{
CDataStream stream((const char*)block_bench::block413567,

BIN
src/bench/data/block413567.raw

Binary file not shown.

2
src/qt/test/test_main.cpp

@ -54,7 +54,7 @@ int main(int argc, char *argv[]) @@ -54,7 +54,7 @@ int main(int argc, char *argv[])
SelectParams(CBaseChainParams::MAIN);
noui_connect();
ClearDatadirCache();
fs::path pathTemp = fs::temp_directory_path() / strprintf("test_bitcoin-qt_%lu_%i", (unsigned long)GetTime(), (int)GetRand(100000));
fs::path pathTemp = fs::temp_directory_path() / strprintf("test_litecoin-qt_%lu_%i", (unsigned long)GetTime(), (int)GetRand(100000));
fs::create_directories(pathTemp);
gArgs.ForceSetArg("-datadir", pathTemp.string());

2
src/qt/test/wallettests.cpp

@ -242,7 +242,7 @@ void TestGUI() @@ -242,7 +242,7 @@ void TestGUI()
QString paymentText = rlist->toPlainText();
QStringList paymentTextList = paymentText.split('\n');
QCOMPARE(paymentTextList.at(0), QString("Payment information"));
QVERIFY(paymentTextList.at(1).indexOf(QString("URI: bitcoin:")) != -1);
QVERIFY(paymentTextList.at(1).indexOf(QString("URI: litecoin:")) != -1);
QVERIFY(paymentTextList.at(2).indexOf(QString("Address:")) != -1);
QCOMPARE(paymentTextList.at(3), QString("Amount: 0.00000001 ") + QString::fromStdString(CURRENCY_UNIT));
QCOMPARE(paymentTextList.at(4), QString("Label: TEST_LABEL_1"));

2
src/test/amount_tests.cpp

@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE(ToStringTest) @@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE(ToStringTest)
{
CFeeRate feeRate;
feeRate = CFeeRate(1);
BOOST_CHECK_EQUAL(feeRate.ToString(), "0.00000001 BTC/kB");
BOOST_CHECK_EQUAL(feeRate.ToString(), "0.00000001 LTC/kB");
}
BOOST_AUTO_TEST_SUITE_END()

234
src/test/data/base58_keys_valid.json

@ -1,47 +1,47 @@ @@ -1,47 +1,47 @@
[
[
"LdwLvykqj2nUH3MWcut6mtjHxVxVFC7st5",
"cd463dbc6f8076c7021f2766b36ea7e19c5c9e2e",
"LbRY3MfWxhv1W88P3DcH94WLpDGZ3qV8aP",
"76a914b1b2c8ecd1a48ef911bd5e6385a8950d3255937588ac",
{
"isPrivkey": false,
"chain": "main"
}
],
[
"3QiEMZmknJkHxz9q2VjTCT1tvUicLvBpdZ",
"fc85afab90ad569ed50fe8771d70aff8a7eb788d",
"37cTNRYxg6TKK31B5d1Xf2cvYwSv7AF7fR",
"a91440f3ea941f260592f9c9433f0250dfe7e5fb128e87",
{
"isPrivkey": false,
"chain": "main"
}
],
[
"mmCKZS7toE69QgXNs1JZcjW6LFj8LfUbz6",
"3e4a9a4a79dcad8800b6cfcdf102bf98064b7454",
"mphsD9aLCQ9kpysu4ecCwAvHWYcsbt31u9",
"76a91464c97697289c7f654ceeab26066537489238d32788ac",
{
"isPrivkey": false,
"chain": "test"
}
],
[
"2N5X5FB9Cro2qW4Dww1pEKYXMhQt8PK6KHM",
"86a0ddc5ce64594f0b84d96596657e1f5e0af7f6",
"mphsD9aLCQ9kpysu4ecCwAvHWYcsbt31u9",
"76a91464c97697289c7f654ceeab26066537489238d32788ac",
{
"isPrivkey": false,
"chain": "regtest"
}
],
[
"6uyyEQaLajn2bVG4DQ9LkwKqdTLWv5fxzSgBBwFMhZnY6SHamHF",
"716bbb0c59dc95f658b169b09c9ada6b106d79ef637dc0a1361aea83b67f3281",
"2NCfHYPmkXdYQub31jnGCH48SN2Ew4KKfzE",
"a914d4f756e1a19ede4011f5839e309da0c43fbee4e887",
{
"isPrivkey": false,
"chain": "test"
}
],
[
"T92ej9rAJ2HEKBtXKpcQEB88KMjBUW43uVxzwgAAYmm97CbDfuB2",
"b257a0d8b63aac2cbac1f6b57c73ee6313650a000ac895456f633e05e1f276b1",
"6w1p6pcTBjzx8cwm4otGNWjs6U7JGp73U2S4PjYFEdssBqb3ozw",
"f94cfafdc6a1291f3379f7527465f391d932853c0caf452b1d3d5ce26d47d3da",
{
"isCompressed": false,
"isPrivkey": true,
@ -49,8 +49,8 @@ @@ -49,8 +49,8 @@
}
],
[
"93UCtAocH3kKPwoqEcjNGR1qi9MLkhQio2vMjWCMdEsBNwTKszg",
"f8270343a5cc4936c0f304520700b9a9f443dddeb5b2bfa9ef8414d126e9835b",
"T8d1EGiyxUNiMqheh7siBtbAxnpy5Scq9ACMH8gtHXvWZsJcHrxn",
"a62d79737a443b898b77bec8e98bc6c27acd9c8b4a222e0c0f2ca01591ff38fc",
{
"isCompressed": true,
"isPrivkey": true,
@ -58,8 +58,8 @@ @@ -58,8 +58,8 @@
}
],
[
"cU3MMfRXJpVuVXKdkqn1x8cqEHz4AfyBmVFj7CvBUdApAZYo6Lj8",
"c0bbf61af02667b9a7c172c2d4bfa64ac9d4553f7ae19fb295c06e77cc799296",
"92Uz6EVHCNXUu77uKfedTaGor28x7qaERbNFG3vvnt7xML19K9P",
"7639e3b1907cf81533da2ed547f3ad3c122456afc47a00dbfbc795aa07e0fb01",
{
"isCompressed": false,
"isPrivkey": true,
@ -67,8 +67,8 @@ @@ -67,8 +67,8 @@
}
],
[
"LWZR9ybwmT8vSXP6tmrBX4b6nE9o94AjQG",
"7c57bc50a38d8377ad55260f29f2c8619846ef08",
"92Uz6EVHCNXUu77uKfedTaGor28x7qaERbNFG3vvnt7xML19K9P",
"7639e3b1907cf81533da2ed547f3ad3c122456afc47a00dbfbc795aa07e0fb01",
{
"isCompressed": false,
"isPrivkey": true,
@ -76,8 +76,8 @@ @@ -76,8 +76,8 @@
}
],
[
"32wfwbXojzQN9vYFQGquFTt7sqKnB8Phyz",
"0dbdaf6928107d60299f5069367c4cf07fa9b6e5",
"cTToo8w9eJVfZSR8R5F8VzQ8rZb5oRwgABKbzer9g3HJqxfyj3ye",
"af7a53dbe5e1f9513e2f2620c58dff15730cebf3a9b560cbf4aaad2768d40fa4",
{
"isCompressed": true,
"isPrivkey": true,
@ -85,8 +85,8 @@ @@ -85,8 +85,8 @@
}
],
[
"mvJg85FLYqN7xAcZeFZRVg7pMbJ53BqKmy",
"a237653c5ae7e18e840d6463d380701ce3ba5035",
"cTToo8w9eJVfZSR8R5F8VzQ8rZb5oRwgABKbzer9g3HJqxfyj3ye",
"af7a53dbe5e1f9513e2f2620c58dff15730cebf3a9b560cbf4aaad2768d40fa4",
{
"isCompressed": true,
"isPrivkey": true,
@ -94,40 +94,40 @@ @@ -94,40 +94,40 @@
}
],
[
"2NCGcqUHf4q4vE2MZD6bnaVzFUSKPM4WCDX",
"d0ade0e231a81794ed1baa081604de53ddd8b083",
"Laq1dYLSYPifTjCeT9DCr1Puiy7k7Ewy5B",
"76a914ab2b41b4206db6c39f74c25453dfa5ff90074e2688ac",
{
"isPrivkey": false,
"chain": "main"
}
],
[
"6w3nZ8BsJLuJwe42QpFAwCZC9EFz4e2k1ewhRT9ab2poUv8KSu7",
"fdc80a3b189a9d64a1fb8e5a9905d92922f77e135a235a06046147f10d4f09be",
"3AejjPrJLpUf83mkWL1HXbMNTYjAFWfowj",
"a914624ac89642e04d39ce36976e861a022742cc127a87",
{
"isPrivkey": false,
"chain": "main"
}
],
[
"T5EAeSR4zfUGvNiA4iCVPpV8Gz6ZUGAT94bsBqTv3kd81hNQCgzY",
"40eab9b09d0469a7d9f84dae6bc5f98199e0b187fe4e74013cab437f9306ea00",
"mhoT6gsCtPmeY5m5S93FPv5y11Zft7mDAv",
"76a914190ef38c041b5ae687f2ef20a6131e755e12a12188ac",
{
"isPrivkey": false,
"chain": "test"
}
],
[
"92hDYngM3s5oLTK6Fsq1JKLLSgL5NdarzLm8r9ymzEfQzCB24cJ",
"92001dd4cb225cdc0cf9fe2f824c807ffedd5235c9c0ca014949d0793fc66868",
"2NAMtME59NepzTTip2onh56JHaTYzXR7QTH",
"a914bbbca803acbbe7a2153f0cac05491b624c72426b87",
{
"isPrivkey": false,
"chain": "test"
}
],
[
"cQFFjska277aBhcbCaEdBSixz1BXEgnLoGYECu9mKJip3GBco8CL",
"4f8210f4e6830d16fa8818d37fa9aed65664a20f3c41bfa5b502cdc8d1173dcb",
"6vfHCU94rDbNkXCid4iNw2aNbwYQrHch6ghjYfSpC8vMPK9CPjB",
"caadafa39dfa11d59f36b918a9b6ca057953f9eb2066796549d2d3a4124c273d",
{
"isCompressed": false,
"isPrivkey": true,
@ -135,8 +135,8 @@ @@ -135,8 +135,8 @@
}
],
[
"LWkdEB9SHUfuBiTvZofK2LqYE4RTTtUcqi",
"7e766382cb564021bcbc273e23569dcaed536ac6",
"T45iMqhBgU8Qoer7dhGQb5UhmwvAQZLZbuHYorkneyaACDmij5Cm",
"1ebb18d9365fde2e29c7ef8494ac1d284fb332f24a0243d59a8070332940f573",
{
"isCompressed": true,
"isPrivkey": true,
@ -144,8 +144,8 @@ @@ -144,8 +144,8 @@
}
],
[
"32cjrquumLmwSmBrNCbkU5UTUmtgetWqaL",
"0a290d74c272ab52dec1a87ce88e75d29c94fe5a",
"93DVKyFYwSN6wEo3E2fCrFPUp17FtrtNi2Lf7n4G3garFb16CRj",
"d6bca256b5abc5602ec2e1c121a08b0da2556587430bcf7e1898af2224885203",
{
"isCompressed": false,
"isPrivkey": true,
@ -153,8 +153,8 @@ @@ -153,8 +153,8 @@
}
],
[
"mtei3esVvHhww4Rw9FYnMdTUTVvbpWhLfF",
"901111ab28cf850a5b6846e94e8c0c4a505603a9",
"cTDVKtMGVYWTHCb1AFjmVbEbWjvKpKqKgMaR3QJxToMSQAhmCeTN",
"a81ca4e8f90181ec4b61b6a7eb998af17b2cb04de8a03b504b9e34c4c61db7d9",
{
"isCompressed": true,
"isPrivkey": true,
@ -162,40 +162,40 @@ @@ -162,40 +162,40 @@
}
],
[
"2N85CqWKWqfZ5Hc9qGXWmr5JKZzMqZCRDPM",
"a2a4c41bd7150d28aa730140cebf7aa5341e2619",
"LcCLxZSuwCMonMGeBcHqQ1SbsKyWKtVmBB",
"76a914ba2c4073e5355bfe37e06fdd9b42f644fb9ae76b88ac",
{
"isPrivkey": false,
"chain": "main"
}
],
[
"6vfWJ2KcJLjvXXx8aZNsLcQQnxTvXA38ci22BvhprTq5QpRS6k6",
"cb30eec426333b2396d2362d4a380d7f6a4ae50a2701309a53f500fa389c166c",
"3DhmeSnrhxFeeH6Ci2iKf8XpDuLXJRMQre",
"a91483c601cee58d9324d8797e04c360971a7222a25387",
{
"isPrivkey": false,
"chain": "main"
}
],
[
"T9xQZ1QYhGyYp7wzRQuLdfm1te8BwrnvWsibt6GXuK58Xoq2wryN",
"cdff0814191533898aa1e6291f2c77e1a1945a732f70b8f09aadc637e9241e59",
"mgpyL2ueFkKYo8DigPfqi9mGaXhTpBfXFK",
"76a9140e6079f1d5522fc3643b684854d2caeb9f80b79388ac",
{
"isPrivkey": false,
"chain": "test"
}
],
[
"93C56vYXBM3XycR9M9pDNY333bTLT8KeqTpRXKSncruKpeuvfZ5",
"d3849230c2d8bd3590708a8ff485deea6a73916a664255f95179282b146854fe",
"2N75C1JVmQgdzwq7ovUqoW8aWZ1wodNCy84",
"a91497abf24db1094d659b319fafbdb5995ffc6e5ff487",
{
"isPrivkey": false,
"chain": "test"
}
],
[
"cV7TW5gn8yJjrVy4mfYLDY1tfYN7o81tjeubEeqWxzyjdcU7Bv9F",
"e0af129330504deb99dd989339b96d77ce3782a852b8e61a4367394505abc3e0",
"6vNcAgpwLv5NVF4yNTSoi9Jsp6gWURmEnYJKVuYMumdG38s83fh",
"a4d20c8ade1d8af00ddb974c2f26207b21054d4a1f61c0615ca01a6b97ce7a28",
{
"isCompressed": false,
"isPrivkey": true,
@ -203,8 +203,8 @@ @@ -203,8 +203,8 @@
}
],
[
"LVcGHJcTv1ctR6GLRXxR4SQSsycdmQ6pwZ",
"71e9734a1283f2368bbd5a397d3c7a22610b2958",
"T4Fe1n9xDKUHWVFNqcM9z6GwoQeDm53xBqjtf1jgp1tKVJsLZHnv",
"23d630aec25b8a1dcaddd2b02e1eae7a37e105d9b7e8201b697e99f11e23b05a",
{
"isCompressed": true,
"isPrivkey": true,
@ -212,8 +212,8 @@ @@ -212,8 +212,8 @@
}
],
[
"35CcFdsWEiXv4cuHjR8G54FYvrrDtm4WUm",
"268118c8299cd5d8d3b9561caaf8c94d4bd1af44",
"927W7aK3WFBvh4DQrC3rt7h9MyDTAysFkVtya7bFfmEmvQEHEQz",
"4572a355117fa704d8706ab21c0cae21624a563f36644f1363f101294f939906",
{
"isCompressed": false,
"isPrivkey": true,
@ -221,8 +221,8 @@ @@ -221,8 +221,8 @@
}
],
[
"myWBvpVEeY86YvJLb5kwH2iWbdXPGjTtZk",
"c54d3aa920e78e56b72c0076d36e99bc87058397",
"cULmtisjsoJ6tavY7sNYCcFc7GvU9PzaXdpm4yRpwH7VyVxFPx97",
"c9b2817ef47867ffa958cb8ecae6388ea7d4b6a72c85f97b15d555c9d2d70464",
{
"isCompressed": true,
"isPrivkey": true,
@ -230,40 +230,40 @@ @@ -230,40 +230,40 @@
}
],
[
"2N54Ew2vPqzA9PxG89rB1LM8MVfgePiCKqV",
"818db8c869c5911d286d37088de9020cca43f702",
"LbCdD5HhF8mtzqpAhAL44hRUpVXGthe3wv",
"76a914af41b0e60bddd25fd0986c061d2c38dc8d92f23d88ac",
{
"isPrivkey": false,
"chain": "main"
}
],
[
"6uM1BTu9jkS6cMfFTtxzutmcNQYVpTome57XhxES6xKiiN7eM4v",
"1d7bee7a5f4be2bcd945a4bdce28a479bb1afcf4d925d29de0124325bb55277d",
"3JeorZ28ejxcnfB5ideySCCnvuKrRMSrRD",
"a914ba0f3b5ba0efb58cda3e55f13b18462c971e6df987",
{
"isPrivkey": false,
"chain": "main"
}
],
[
"T6gDa2FYoYuCDpeJy8ePrdTVqxxvZ9H5nCqmdVCiRvLBWr1jymE9",
"6c27d6190e8c49919b7c0919d1ca1b033c2b72b03234728d0b092087983f2544",
"n3cBcftzi5PyYRCaqjnHB9LS9C1r8AUKtT",
"76a914f24ff783c81d1bbeca87b10e3e63300952ce644088ac",
{
"isPrivkey": false,
"chain": "test"
}
],
[
"91epwsbfDsLwAum2kYeibW9v3cyM9ALeHxFoR1wh7g8w58gihCj",
"08e0d6cf0999a1427830e034b5281c8112d707d463da05d993d8b2b66985d91f",
"2MwSJjJUSxjh6C57PcQDqbVWR8mCSsbhfG9",
"a9142df90970f496d9e6e165a69dacd1417f082c5cf587",
{
"isPrivkey": false,
"chain": "test"
}
],
[
"cTNjHC1zu7CifxVJ7g9V16LKVokd7D1XuEvqTtA88uwTsRUFXmWj",
"acdd979c5e6eb9e619dfede5c7112af1057442c8799c1e1d85d7bf59892c923a",
"6vof9cxLQzMQUA3GdMY7RPyN8v2uxGeYsvVBrJ2Csurini4gtiV",
"ddb3e9ec9271fb4ccf1a0782e87724359730f8c621698ede6a8a33a1b9bb0a46",
{
"isCompressed": false,
"isPrivkey": true,
@ -271,8 +271,8 @@ @@ -271,8 +271,8 @@
}
],
[
"LPD8ZwGjE4WmQ1EEnjZHrvofSyvGtbEWsH",
"2bb8b0991f396d7f411c2227af00cc09d1ae0adf",
"T7ZjgRCVmxcnffbXoJgzXfPUfUHUvQz5KUDz188ufR8jCQepDwXt",
"86a8b4cb9cabbe39f870b65cb9f7e59b4ae9ce0419dab18cf8bcd29a9575871d",
{
"isCompressed": true,
"isPrivkey": true,
@ -280,8 +280,8 @@ @@ -280,8 +280,8 @@
}
],
[
"35Bjf3NUkU6CNqUFB4HnkaYqN3VPMYwUED",
"2656dc6ac50a5bdeb80348b9097af31e74698f44",
"92sia8ejeCaQ6gKmuraWqpUmv3S6qroQeAsc2nfQZrAiDMnyCQp",
"a9d7c81a8a30cde427c3c530c024e59fbe80a57d55960fffe9948e4366c02ac9",
{
"isCompressed": false,
"isPrivkey": true,
@ -289,8 +289,8 @@ @@ -289,8 +289,8 @@
}
],
[
"mhv2Ti1xy9CsWoYgnEjehEunbhFiyFwLAp",
"1a4d4bf230aabafd3a425770b8b98700bf06e370",
"92sia8ejeCaQ6gKmuraWqpUmv3S6qroQeAsc2nfQZrAiDMnyCQp",
"a9d7c81a8a30cde427c3c530c024e59fbe80a57d55960fffe9948e4366c02ac9",
{
"isCompressed": false,
"isPrivkey": true,
@ -298,8 +298,8 @@ @@ -298,8 +298,8 @@
}
],
[
"2MwyQVPME89pGMxuX3fRwEgfXtgN1Y1wB7e",
"33dabd6dfda94c9c1ef1654a3c3b1e0984a7aecf",
"cQQ6SPSVoyTBUdstHJJF9YuCLUxfKLnnVAuwfQeREsnmLeTdrSRp",
"540e35fab67b2ff9c6fef795ba0da1114705721bcb387ee93f9c09412d2b3ab5",
{
"isCompressed": true,
"isPrivkey": true,
@ -307,40 +307,40 @@ @@ -307,40 +307,40 @@
}
],
[
"6uqTHcTC88EcZ8RQJDoH7dFfH46E8ZNpThbEKXCiQ12ag2GeHQ7",
"5e15635f0be1e9717529fb2b65b0d430355f0f5db5811b47fc6545efbe082b23",
"LXbHo4W9BDZYwv6v9x57kLZ2r9YNyqBgWA",
"76a91487aa8c8a26a6cc0c7a7d438e61bfa49a33e9cbab88ac",
{
"isPrivkey": false,
"chain": "main"
}
],
[
"T34vLND26MHR4j1L8qsmojWcHtwYcmDdibMrsgo41SRYDDDdJzQe",
"007c379af039e5472c784a1f41ccea5de8b8d6fde03139644f12294a5a4dc20d",
"3JDygZLWw2YBo7RhhJFQrVsGnsDHMghUTJ",
"a914b55d095bc6c28b86d87b313442aa3ee454e49cce87",
{
"isPrivkey": false,
"chain": "main"
}
],
[
"932VXf7wK3qQTGzudkeHWME2iweTTdyfyxQV4HqWLZsocbVQMgZ",
"bdc494c6c492168886d7d19fe35c4e67c477f8e19bfe1b50a4b28a7f0910ac02",
"moJfnqA4SviQhxStcqR4PFvCU2bjYEx873",
"76a914556e3cee7b8d470f5c3f507c4c54781cfc179ea688ac",
{
"isPrivkey": false,
"chain": "test"
}
],
[
"cUNY2YHa2TZRNMKBjypnZ1kh7LnPzgBhapKQgqh8MXGGVQTqdqQS",
"ca9a6a553f353255f2d91fde1718bd1f86c40c0b16f2aaccf8efefe242f5a7b6",
"2N1ihb5sKJAM9y2McELzcg7p6Wf2rj9sedy",
"a9145cf346cd43ff078ca1d8dc62e39207470e2a496b87",
{
"isPrivkey": false,
"chain": "test"
}
],
[
"LPGeGFBPCVLHdGVD1i1oikzD92XZoTEVyh",
"2c62b9d0c13b499167506863248f473416b18850",
"6vwfYtMbBhF5Pn9yUHHP4GcW274C9bK8UgCvCMgCGmCdfwSND4p",
"efe22b1f976043089a51deff8d0b8c3df2b23748f4d0eadb6641503637c63869",
{
"isCompressed": false,
"isPrivkey": true,
@ -348,8 +348,8 @@ @@ -348,8 +348,8 @@
}
],
[
"37h7vEB4v3jpqxKvX1qqJ5xZaqzLj7NPyN",
"41d5c23a8188270b32d0afce2e11e4c3028afe6b",
"T6UPi92VfnBy24YJnkPthhpstCrUA1tLkbLud5tk9nEwoXqTQkZZ",
"661281d55763ba511ced34e909a99d0926daddbeb3109644937061b6cf913782",
{
"isCompressed": true,
"isPrivkey": true,
@ -357,8 +357,8 @@ @@ -357,8 +357,8 @@
}
],
[
"mhvk8vH4LaAgUBUJsU4UtL4KSWLavssToW",
"1a701609b7d938f932d9517f965eb938ec45d067",
"92ZmYqEbmGrKfHp1usJrj5qAYnwvFihby1XYL82riva5EZhuvjj",
"8116986e76487416346994d08b5248622471e2836943f695d7351868f520ba6b",
{
"isCompressed": false,
"isPrivkey": true,
@ -366,8 +366,8 @@ @@ -366,8 +366,8 @@
}
],
[
"2NBbbBFBoKk85mhvTJH4tc11U1zh4oqp7SG",
"c94c4561b8ec99cddd540dedc67380c6b859ae00",
"cUAXZmhBU724DznSwsZnqjhixqrkqwXXWCGAZcJkBXdgPuBi4CZd",
"c46d03a638e031a5a0d025bac050875f5c79bef6d47b377ab5eff92563549e7b",
{
"isCompressed": true,
"isPrivkey": true,
@ -375,40 +375,40 @@ @@ -375,40 +375,40 @@
}
],
[
"6vQqYTYdTXyHLcAivoZ6N2pginHXkZj9DF8uu9rroj5jT32joQn",
"a9e2a8019c11e6fd215f5c2ae834c7f07207723cac79b4e22744800c97212ac1",
"LiRGLiaD9yaUNZbe9GKptX5PybiQZzioED",
"76a914fe6e8f1ff538103ede6451c57d5dcbeaf376821d88ac",
{
"isPrivkey": false,
"chain": "main"
}
],
[
"T7qqfYACj4bdqNMm9ZMMNtbaMXRzePBpL59msQiWw7i5JRuDLFVB",
"8ef16edbbc8996a1be1c8a8d7de566a489a84484912060471158c0d20fcd42ba",
"31jGHN3LcY7TwWKqVdcfnPGH44aH3KraGB",
"a914006cd1745e13749236c7064614d93d4650a79e4887",
{
"isPrivkey": false,
"chain": "main"
}
],
[
"91pvMZgXhzBit7xx2NrbgMiuVZJep46gTCdvFkQTijTA76Gzxfc",
"1fcbd613ad91f41e062a66b11299585cff1639775df447360e74fbeea1e336c8",
"mfkrC62Px74E6mpQS137ecE6c3A7LzFMV7",
"76a91402a0baa2a00912fa6b7db5ec66f64ad3dafe650988ac",
{
"isPrivkey": false,
"chain": "test"
}
],
[
"cVWTK7AxBVgndSKS6Xs54XonuEh4NUhaHVtyzrWhHfQ2rLWdVrNy",
"ec83a732c245dc6df111d6412aa1b2ed78072ae3ebaa499660ccb7f013adca8f",
"2NAsiEa8cV97iyHhtfavP4t4TUqyEfT4vWf",
"a914c160b11a8a042e801487f9f0c13be0246adff58687",
{
"isPrivkey": false,
"chain": "test"
}
],
[
"LhLu7S8qdG7YZR1GgSP8g4aqN8nXCRLkzX",
"f2a30c60e4abcbbdcdf7cb34520b742ae07b6018",
"6vRJaVegzBxTXdgGEimmmSsEv1CLdAgfpaHsZbXUxkPfm9H8U7X",
"aaf19a8a8eacca26b2ec3678e47ee22a04fc1efac61bcd2a41af332be63bab8b",
{
"isCompressed": false,
"isPrivkey": true,
@ -416,8 +416,8 @@ @@ -416,8 +416,8 @@
}
],
[
"3B7BZ4asi1qP4jQmo4UjshAp4ZtgmpA7CW",
"674b274f2be5747793d2529972d964f1cfe9f985",
"T7LHhPHG4mno7XPvBXajDrA5v2nLVSw16sTErD9y6Yki3bGTuHgf",
"7fbda89e59e07db5897cabfde8eb8036d4bebdfddfeac97319e74c74c02799f2",
{
"isCompressed": true,
"isPrivkey": true,
@ -425,8 +425,8 @@ @@ -425,8 +425,8 @@
}
],
[
"93N87D6uxSBzwXvpokpzg8FFmfQPmvX4xHoWQe3pLdYpbiwT5YV",
"ea577acfb5d1d14d3b7b195c321566f12f87d2b77ea3a53f68df7ebf8604a801",
"93VwGxfztHBcUefSWA3JMzKsr6Jg4atmZdKvi1MXTgB9HLypXry",
"fc1528167b31735464059aef58cf71b501eaa146bae7e47f406c61f7ac28555c",
{
"isCompressed": false,
"isPrivkey": true,
@ -434,8 +434,8 @@ @@ -434,8 +434,8 @@
}
],
[
"cMxXusSihaX58wpJ3tNuuUcZEQGt6DKJ1wEpxys88FFaQCYjku9h",
"0b3b34f0958d8a268193a9814da92c3e8b58b4a4378a542863e34ac289cd830c",
"cW8HPuCThQ4EsLEU8S6Gborp7NfwXDc2uh2Aua83kmhjqN8GzEVk",
"fef231a9299de5b2d3ea012cd2471bdc80d38e489f5f4a7803ac3279a7d727a9",
{
"isCompressed": true,
"isPrivkey": true,
@ -443,23 +443,23 @@ @@ -443,23 +443,23 @@
}
],
[
"13p1ijLwsnrcuyqcTvJXkq2ASdXqcnEBLE",
"76a9141ed467017f043e91ed4c44b4e8dd674db211c4e688ac",
"LeZc1mA2SgaNTJ4WE8pKegNKbZekqovqvK",
"76a914d421ce551279f3fdfb6e4f7390b06516c3daaaa288ac",
{
"isPrivkey": false,
"chain": "main"
}
],
[
"3ALJH9Y951VCGcVZYAdpA3KchoP9McEj1G",
"a9145ece0cadddc415b1980f001785947120acdb36fc87",
"31owTMbdP5CGappffhFA1unRVCsdpwKuWF",
"a914014f2e7072e9907c7f636d937759b8ceb1053feb87",
{
"isPrivkey": false,
"chain": "main"
}
],
[
"bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4",
"ltc1qw508d6qejxtdg4y5r3zarvary0c5xw7kgmn4n9",
"0014751e76e8199196d454941c45d1b3a323f1433bd6",
{
"isPrivkey": false,
@ -468,7 +468,7 @@ @@ -468,7 +468,7 @@
}
],
[
"bcrt1qw508d6qejxtdg4y5r3zarvary0c5xw7kygt080",
"rltc1qw508d6qejxtdg4y5r3zarvary0c5xw7k693xs3",
"0014751e76e8199196d454941c45d1b3a323f1433bd6",
{
"isPrivkey": false,
@ -477,7 +477,7 @@ @@ -477,7 +477,7 @@
}
],
[
"tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sl5k7",
"tltc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qsnr4fp",
"00201863143c14c5166804bd19203356da136c985678cd4d27a1b8c6329604903262",
{
"isPrivkey": false,
@ -486,7 +486,7 @@ @@ -486,7 +486,7 @@
}
],
[
"bc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7k7grplx",
"ltc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7k0tul4w",
"5128751e76e8199196d454941c45d1b3a323f1433bd6751e76e8199196d454941c45d1b3a323f1433bd6",
{
"isPrivkey": false,
@ -495,7 +495,7 @@ @@ -495,7 +495,7 @@
}
],
[
"bc1sw50qa3jx3s",
"ltc1sw50qzgydf5",
"6002751e",
{
"isPrivkey": false,
@ -504,7 +504,7 @@ @@ -504,7 +504,7 @@
}
],
[
"bc1zw508d6qejxtdg4y5r3zarvaryvg6kdaj",
"ltc1zw508d6qejxtdg4y5r3zarvaryvdzur3w",
"5210751e76e8199196d454941c45d1b3a323",
{
"isPrivkey": false,
@ -513,7 +513,7 @@ @@ -513,7 +513,7 @@
}
],
[
"tb1qqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvsesrxh6hy",
"tltc1qqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvsesu9tmgm",
"0020000000c4a5cad46221b2a187905e5266362b99d5e91c6ce24d165dab93e86433",
{
"isPrivkey": false,
@ -522,7 +522,7 @@ @@ -522,7 +522,7 @@
}
],
[
"bcrt1qqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvseswlauz7",
"rltc1qqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvsesxuhrdn",
"0020000000c4a5cad46221b2a187905e5266362b99d5e91c6ce24d165dab93e86433",
{
"isPrivkey": false,
@ -530,4 +530,4 @@ @@ -530,4 +530,4 @@
"tryCaseFlip": true
}
]
]
]

2
src/test/test_bitcoin_main.cpp

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#define BOOST_TEST_MODULE Bitcoin Test Suite
#define BOOST_TEST_MODULE Litecoin Test Suite
#include <net.h>

2
src/wallet/test/wallet_tests.cpp

@ -437,7 +437,7 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup) @@ -437,7 +437,7 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup)
"timestamp %d. There was an error reading a block from time %d, which is after or within %d "
"seconds of key creation, and could contain transactions pertaining to the key. As a result, "
"transactions and coins using this key may not appear in the wallet. This error could be caused "
"by pruning or data corruption (see bitcoind log for details) and could be dealt with by "
"by pruning or data corruption (see litecoind log for details) and could be dealt with by "
"downloading and rescanning the relevant blocks (see -reindex and -rescan "
"options).\"}},{\"success\":true}]",
0, oldTip->GetBlockTimeMax(), TIMESTAMP_WINDOW));

20
test/functional/feature_block.py

@ -114,10 +114,12 @@ class FullBlockTest(ComparisonTestFramework): @@ -114,10 +114,12 @@ class FullBlockTest(ComparisonTestFramework):
coinbase.rehash()
if spend == None:
block = create_block(base_block_hash, coinbase, block_time)
block.nVersion = 0x20000000
else:
coinbase.vout[0].nValue += spend.tx.vout[spend.n].nValue - 1 # all but one satoshi to fees
coinbase.rehash()
block = create_block(base_block_hash, coinbase, block_time)
block.nVersion = 0x20000000
tx = create_transaction(spend.tx, spend.n, b"", 1, script) # spend 1 satoshi
self.sign_tx(tx, spend.tx, spend.n)
self.add_transactions_to_block(block, [tx])
@ -619,6 +621,7 @@ class FullBlockTest(ComparisonTestFramework): @@ -619,6 +621,7 @@ class FullBlockTest(ComparisonTestFramework):
height = self.block_heights[self.tip.sha256] + 1
coinbase = create_coinbase(height, self.coinbase_pubkey)
b44 = CBlock()
b44.nVersion = 0x20000000
b44.nTime = self.tip.nTime + 1
b44.hashPrevBlock = self.tip.sha256
b44.nBits = 0x207fffff
@ -633,6 +636,7 @@ class FullBlockTest(ComparisonTestFramework): @@ -633,6 +636,7 @@ class FullBlockTest(ComparisonTestFramework):
# A block with a non-coinbase as the first tx
non_coinbase = create_tx(out[15].tx, out[15].n, 1)
b45 = CBlock()
b45.nVersion = 0x20000000
b45.nTime = self.tip.nTime + 1
b45.hashPrevBlock = self.tip.sha256
b45.nBits = 0x207fffff
@ -648,6 +652,7 @@ class FullBlockTest(ComparisonTestFramework): @@ -648,6 +652,7 @@ class FullBlockTest(ComparisonTestFramework):
# A block with no txns
tip(44)
b46 = CBlock()
b46.nVersion = 0x20000000
b46.nTime = b44.nTime+1
b46.hashPrevBlock = b44.sha256
b46.nBits = 0x207fffff
@ -661,14 +666,15 @@ class FullBlockTest(ComparisonTestFramework): @@ -661,14 +666,15 @@ class FullBlockTest(ComparisonTestFramework):
s = ser_uint256(b46.hashMerkleRoot)
yield rejected(RejectResult(16, b'bad-blk-length'))
# Litecoin: Temporarily disable test
# A block with invalid work
tip(44)
b47 = block(47, solve=False)
target = uint256_from_compact(b47.nBits)
while b47.scrypt256 < target: #changed > to <
b47.nNonce += 1
b47.rehash()
yield rejected(RejectResult(16, b'high-hash'))
#tip(44)
#b47 = block(47, solve=False)
#target = uint256_from_compact(b47.nBits)
#while b47.scrypt256 < target: #changed > to <
# b47.nNonce += 1
# b47.rehash()
#yield rejected(RejectResult(16, b'high-hash'))
# A block with timestamp > 2 hrs in the future
tip(44)

9
test/functional/feature_cltv.py

@ -21,6 +21,7 @@ CLTV_HEIGHT = 1351 @@ -21,6 +21,7 @@ CLTV_HEIGHT = 1351
REJECT_INVALID = 16
REJECT_OBSOLETE = 17
REJECT_NONSTANDARD = 64
VB_TOP_BITS = 0x20000000
def cltv_invalidate(tx):
'''Modify the signature in vin 0 of the tx to fail CLTV
@ -87,7 +88,7 @@ class BIP65Test(BitcoinTestFramework): @@ -87,7 +88,7 @@ class BIP65Test(BitcoinTestFramework):
tip = self.nodes[0].getbestblockhash()
block_time = self.nodes[0].getblockheader(tip)['mediantime'] + 1
block = create_block(int(tip, 16), create_coinbase(CLTV_HEIGHT - 1), block_time)
block.nVersion = 3
block.nVersion = VB_TOP_BITS
block.vtx.append(spendtx)
block.hashMerkleRoot = block.calc_merkle_root()
block.solve()
@ -95,7 +96,7 @@ class BIP65Test(BitcoinTestFramework): @@ -95,7 +96,7 @@ class BIP65Test(BitcoinTestFramework):
self.nodes[0].p2p.send_and_ping(msg_block(block))
assert_equal(self.nodes[0].getbestblockhash(), block.hash)
self.log.info("Test that blocks must now be at least version 4")
self.log.info("Test that blocks must now be at least version VB_TOP_BITS")
tip = block.sha256
block_time += 1
block = create_block(tip, create_coinbase(CLTV_HEIGHT), block_time)
@ -112,7 +113,7 @@ class BIP65Test(BitcoinTestFramework): @@ -112,7 +113,7 @@ class BIP65Test(BitcoinTestFramework):
del self.nodes[0].p2p.last_message["reject"]
self.log.info("Test that invalid-according-to-cltv transactions cannot appear in a block")
block.nVersion = 4
block.nVersion = VB_TOP_BITS
spendtx = create_transaction(self.nodes[0], self.coinbase_blocks[1],
self.nodeaddress, 1.0)
@ -143,7 +144,7 @@ class BIP65Test(BitcoinTestFramework): @@ -143,7 +144,7 @@ class BIP65Test(BitcoinTestFramework):
else:
assert b'Negative locktime' in self.nodes[0].p2p.last_message["reject"].reason
self.log.info("Test that a version 4 block with a valid-according-to-CLTV transaction is accepted")
self.log.info("Test that a version VB_TOP_BITS block with a valid-according-to-CLTV transaction is accepted")
spendtx = cltv_validate(self.nodes[0], spendtx, CLTV_HEIGHT - 1)
spendtx.rehash()

2
test/functional/feature_config_args.py

@ -28,7 +28,7 @@ class ConfArgsTest(BitcoinTestFramework): @@ -28,7 +28,7 @@ class ConfArgsTest(BitcoinTestFramework):
self.assert_start_raises_init_error(0, ['-datadir='+new_data_dir], 'Error: Specified data directory "' + new_data_dir + '" does not exist.')
# Check that using non-existent datadir in conf file fails
conf_file = os.path.join(default_data_dir, "bitcoin.conf")
conf_file = os.path.join(default_data_dir, "litecoin.conf")
with open(conf_file, 'a', encoding='utf8') as f:
f.write("datadir=" + new_data_dir + "\n")
self.assert_start_raises_init_error(0, ['-conf='+conf_file], 'Error reading configuration file: specified data directory "' + new_data_dir + '" does not exist.')

21
test/functional/feature_csv_activation.py

@ -57,6 +57,7 @@ seq_disable_flag = 1<<31 @@ -57,6 +57,7 @@ seq_disable_flag = 1<<31
seq_random_high_bit = 1<<25
seq_type_flag = 1<<22
seq_random_low_bit = 1<<18
VB_TOP_BITS = 0x20000000
# b31,b25,b22,b18 represent the 31st, 25th, 22nd and 18th bits respectively in the nSequence field
# relative_locktimes[b31][b25][b22][b18] is a base_relative_locktime with the indicated bits set if their indices are 1
@ -95,7 +96,7 @@ class BIP68_112_113Test(ComparisonTestFramework): @@ -95,7 +96,7 @@ class BIP68_112_113Test(ComparisonTestFramework):
def set_test_params(self):
self.num_nodes = 1
self.setup_clean_chain = True
self.extra_args = [['-whitelist=127.0.0.1', '-blockversion=4', '-addresstype=legacy']]
self.extra_args = [['-whitelist=127.0.0.1', '-blockversion=536870912', '-addresstype=legacy']]
def run_test(self):
test = TestManager(self, self.options.tmpdir)
@ -210,7 +211,7 @@ class BIP68_112_113Test(ComparisonTestFramework): @@ -210,7 +211,7 @@ class BIP68_112_113Test(ComparisonTestFramework):
self.nodeaddress = self.nodes[0].getnewaddress()
assert_equal(get_bip9_status(self.nodes[0], 'csv')['status'], 'defined')
test_blocks = self.generate_blocks(61, 4)
test_blocks = self.generate_blocks(61, VB_TOP_BITS)
yield TestInstance(test_blocks, sync_every_block=False) # 1
# Advanced from DEFINED to STARTED, height = 143
assert_equal(get_bip9_status(self.nodes[0], 'csv')['status'], 'started')
@ -218,7 +219,7 @@ class BIP68_112_113Test(ComparisonTestFramework): @@ -218,7 +219,7 @@ class BIP68_112_113Test(ComparisonTestFramework):
# Fail to achieve LOCKED_IN 100 out of 144 signal bit 0
# using a variety of bits to simulate multiple parallel softforks
test_blocks = self.generate_blocks(50, 536870913) # 0x20000001 (signalling ready)
test_blocks = self.generate_blocks(20, 4, test_blocks) # 0x00000004 (signalling not)
test_blocks = self.generate_blocks(20, VB_TOP_BITS, test_blocks) # 0x00000004 (signalling not)
test_blocks = self.generate_blocks(50, 536871169, test_blocks) # 0x20000101 (signalling ready)
test_blocks = self.generate_blocks(24, 536936448, test_blocks) # 0x20010000 (signalling not)
yield TestInstance(test_blocks, sync_every_block=False) # 2
@ -228,7 +229,7 @@ class BIP68_112_113Test(ComparisonTestFramework): @@ -228,7 +229,7 @@ class BIP68_112_113Test(ComparisonTestFramework):
# 108 out of 144 signal bit 0 to achieve lock-in
# using a variety of bits to simulate multiple parallel softforks
test_blocks = self.generate_blocks(58, 536870913) # 0x20000001 (signalling ready)
test_blocks = self.generate_blocks(26, 4, test_blocks) # 0x00000004 (signalling not)
test_blocks = self.generate_blocks(26, VB_TOP_BITS, test_blocks) # 0x00000004 (signalling not)
test_blocks = self.generate_blocks(50, 536871169, test_blocks) # 0x20000101 (signalling ready)
test_blocks = self.generate_blocks(10, 536936448, test_blocks) # 0x20010000 (signalling not)
yield TestInstance(test_blocks, sync_every_block=False) # 3
@ -236,7 +237,7 @@ class BIP68_112_113Test(ComparisonTestFramework): @@ -236,7 +237,7 @@ class BIP68_112_113Test(ComparisonTestFramework):
assert_equal(get_bip9_status(self.nodes[0], 'csv')['status'], 'locked_in')
# 140 more version 4 blocks
test_blocks = self.generate_blocks(140, 4)
test_blocks = self.generate_blocks(140, VB_TOP_BITS)
yield TestInstance(test_blocks, sync_every_block=False) # 4
### Inputs at height = 572
@ -274,7 +275,7 @@ class BIP68_112_113Test(ComparisonTestFramework): @@ -274,7 +275,7 @@ class BIP68_112_113Test(ComparisonTestFramework):
assert_equal(len(self.nodes[0].getblock(inputblockhash,True)["tx"]), 82+1)
# 2 more version 4 blocks
test_blocks = self.generate_blocks(2, 4)
test_blocks = self.generate_blocks(2, VB_TOP_BITS)
yield TestInstance(test_blocks, sync_every_block=False) # 5
# Not yet advanced to ACTIVE, height = 574 (will activate for block 576, not 575)
assert_equal(get_bip9_status(self.nodes[0], 'csv')['status'], 'locked_in')
@ -353,7 +354,7 @@ class BIP68_112_113Test(ComparisonTestFramework): @@ -353,7 +354,7 @@ class BIP68_112_113Test(ComparisonTestFramework):
# 1 more version 4 block to get us to height 575 so the fork should now be active for the next block
test_blocks = self.generate_blocks(1, 4)
test_blocks = self.generate_blocks(1, VB_TOP_BITS)
yield TestInstance(test_blocks, sync_every_block=False) # 8
assert_equal(get_bip9_status(self.nodes[0], 'csv')['status'], 'active')
@ -379,7 +380,7 @@ class BIP68_112_113Test(ComparisonTestFramework): @@ -379,7 +380,7 @@ class BIP68_112_113Test(ComparisonTestFramework):
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash())
# Next block height = 580 after 4 blocks of random version
test_blocks = self.generate_blocks(4, 1234)
test_blocks = self.generate_blocks(4, VB_TOP_BITS)
yield TestInstance(test_blocks, sync_every_block=False) # 13
### BIP 68 ###
@ -414,7 +415,7 @@ class BIP68_112_113Test(ComparisonTestFramework): @@ -414,7 +415,7 @@ class BIP68_112_113Test(ComparisonTestFramework):
yield TestInstance([[self.create_test_block([tx]), False]]) # 20 - 23
# Advance one block to 581
test_blocks = self.generate_blocks(1, 1234)
test_blocks = self.generate_blocks(1, VB_TOP_BITS)
yield TestInstance(test_blocks, sync_every_block=False) # 24
# Height txs should fail and time txs should now pass 9 * 600 > 10 * 512
@ -425,7 +426,7 @@ class BIP68_112_113Test(ComparisonTestFramework): @@ -425,7 +426,7 @@ class BIP68_112_113Test(ComparisonTestFramework):
yield TestInstance([[self.create_test_block([tx]), False]]) # 26 - 29
# Advance one block to 582
test_blocks = self.generate_blocks(1, 1234)
test_blocks = self.generate_blocks(1, VB_TOP_BITS)
yield TestInstance(test_blocks, sync_every_block=False) # 30
# All BIP 68 txs should pass

7
test/functional/feature_dersig.py

@ -20,6 +20,7 @@ DERSIG_HEIGHT = 1251 @@ -20,6 +20,7 @@ DERSIG_HEIGHT = 1251
REJECT_INVALID = 16
REJECT_OBSOLETE = 17
REJECT_NONSTANDARD = 64
VB_TOP_BITS = 0x20000000
# A canonical signature consists of:
# <30> <total len> <02> <len R> <R> <02> <len S> <S> <hashtype>
@ -75,7 +76,7 @@ class BIP66Test(BitcoinTestFramework): @@ -75,7 +76,7 @@ class BIP66Test(BitcoinTestFramework):
tip = self.nodes[0].getbestblockhash()
block_time = self.nodes[0].getblockheader(tip)['mediantime'] + 1
block = create_block(int(tip, 16), create_coinbase(DERSIG_HEIGHT - 1), block_time)
block.nVersion = 2
block.nVersion = VB_TOP_BITS
block.vtx.append(spendtx)
block.hashMerkleRoot = block.calc_merkle_root()
block.rehash()
@ -84,7 +85,7 @@ class BIP66Test(BitcoinTestFramework): @@ -84,7 +85,7 @@ class BIP66Test(BitcoinTestFramework):
self.nodes[0].p2p.send_and_ping(msg_block(block))
assert_equal(self.nodes[0].getbestblockhash(), block.hash)
self.log.info("Test that blocks must now be at least version 3")
self.log.info("Test that blocks must now be at least VB_TOP_BITS")
tip = block.sha256
block_time += 1
block = create_block(tip, create_coinbase(DERSIG_HEIGHT), block_time)
@ -102,7 +103,7 @@ class BIP66Test(BitcoinTestFramework): @@ -102,7 +103,7 @@ class BIP66Test(BitcoinTestFramework):
del self.nodes[0].p2p.last_message["reject"]
self.log.info("Test that transactions with non-DER signatures cannot appear in a block")
block.nVersion = 3
block.nVersion = VB_TOP_BITS
spendtx = create_transaction(self.nodes[0], self.coinbase_blocks[1],
self.nodeaddress, 1.0)

6
test/functional/interface_bitcoin_cli.py

@ -15,12 +15,12 @@ class TestBitcoinCli(BitcoinTestFramework): @@ -15,12 +15,12 @@ class TestBitcoinCli(BitcoinTestFramework):
def run_test(self):
"""Main test logic"""
self.log.info("Compare responses from gewalletinfo RPC and `bitcoin-cli getwalletinfo`")
self.log.info("Compare responses from gewalletinfo RPC and `litecoin-cli getwalletinfo`")
cli_response = self.nodes[0].cli.getwalletinfo()
rpc_response = self.nodes[0].getwalletinfo()
assert_equal(cli_response, rpc_response)
self.log.info("Compare responses from getblockchaininfo RPC and `bitcoin-cli getblockchaininfo`")
self.log.info("Compare responses from getblockchaininfo RPC and `litecoin-cli getblockchaininfo`")
cli_response = self.nodes[0].cli.getblockchaininfo()
rpc_response = self.nodes[0].getblockchaininfo()
assert_equal(cli_response, rpc_response)
@ -38,7 +38,7 @@ class TestBitcoinCli(BitcoinTestFramework): @@ -38,7 +38,7 @@ class TestBitcoinCli(BitcoinTestFramework):
self.log.info("Make sure that -getinfo with arguments fails")
assert_raises_process_error(1, "-getinfo takes no arguments", self.nodes[0].cli('-getinfo').help)
self.log.info("Compare responses from `bitcoin-cli -getinfo` and the RPCs data is retrieved from.")
self.log.info("Compare responses from `litecoin-cli -getinfo` and the RPCs data is retrieved from.")
cli_get_info = self.nodes[0].cli('-getinfo').send_cli()
wallet_info = self.nodes[0].getwalletinfo()
network_info = self.nodes[0].getnetworkinfo()

2
test/functional/interface_zmq.py

@ -52,7 +52,7 @@ class ZMQTest (BitcoinTestFramework): @@ -52,7 +52,7 @@ class ZMQTest (BitcoinTestFramework):
config.read_file(open(self.options.configfile))
if not config["components"].getboolean("ENABLE_ZMQ"):
raise SkipTest("bitcoind has not been built with zmq enabled.")
raise SkipTest("litecoind has not been built with zmq enabled.")
# Initialize ZMQ context and socket.
# All messages are received in the same socket which means

2
test/functional/mempool_persist.py

@ -104,7 +104,7 @@ class MempoolPersistTest(BitcoinTestFramework): @@ -104,7 +104,7 @@ class MempoolPersistTest(BitcoinTestFramework):
self.start_node(1, extra_args=[])
wait_until(lambda: len(self.nodes[1].getrawmempool()) == 5)
self.log.debug("Prevent bitcoind from writing mempool.dat to disk. Verify that `savemempool` fails")
self.log.debug("Prevent litecoind from writing mempool.dat to disk. Verify that `savemempool` fails")
# to test the exception we are setting bad permissions on a tmp file called mempool.dat.new
# which is an implementation detail that could change and break this test
mempooldotnew1 = mempooldat1 + '.new'

1
test/functional/p2p_fingerprint.py

@ -38,6 +38,7 @@ class P2PFingerprintTest(BitcoinTestFramework): @@ -38,6 +38,7 @@ class P2PFingerprintTest(BitcoinTestFramework):
coinbase = create_coinbase(prev_height + 1)
block_time = prev_median_time + 1
block = create_block(int(prev_hash, 16), coinbase, block_time)
block.nVersion = 0x20000000
block.solve()
blocks.append(block)

4
test/functional/p2p_invalid_block.py

@ -46,6 +46,7 @@ class InvalidBlockRequestTest(ComparisonTestFramework): @@ -46,6 +46,7 @@ class InvalidBlockRequestTest(ComparisonTestFramework):
'''
height = 1
block = create_block(self.tip, create_coinbase(height), self.block_time)
block.nVersion = 0x20000000
self.block_time += 1
block.solve()
# Save the coinbase for later
@ -60,6 +61,7 @@ class InvalidBlockRequestTest(ComparisonTestFramework): @@ -60,6 +61,7 @@ class InvalidBlockRequestTest(ComparisonTestFramework):
test = TestInstance(sync_every_block=False)
for i in range(100):
block = create_block(self.tip, create_coinbase(height), self.block_time)
block.nVersion = 0x20000000
block.solve()
self.tip = block.sha256
self.block_time += 1
@ -75,6 +77,7 @@ class InvalidBlockRequestTest(ComparisonTestFramework): @@ -75,6 +77,7 @@ class InvalidBlockRequestTest(ComparisonTestFramework):
leave merkle root and blockheader unchanged but invalidate the block.
'''
block2 = create_block(self.tip, create_coinbase(height), self.block_time)
block2.nVersion = 0x20000000
self.block_time += 1
# b'0x51' is OP_TRUE
@ -102,6 +105,7 @@ class InvalidBlockRequestTest(ComparisonTestFramework): @@ -102,6 +105,7 @@ class InvalidBlockRequestTest(ComparisonTestFramework):
Make sure that a totally screwed up block is not valid.
'''
block3 = create_block(self.tip, create_coinbase(height), self.block_time)
block3.nVersion = 0x20000000
self.block_time += 1
block3.vtx[0].vout[0].nValue = 100 * COIN # Too high!
block3.vtx[0].sha256=None

2
test/functional/p2p_invalid_tx.py

@ -41,6 +41,7 @@ class InvalidTxRequestTest(ComparisonTestFramework): @@ -41,6 +41,7 @@ class InvalidTxRequestTest(ComparisonTestFramework):
'''
height = 1
block = create_block(self.tip, create_coinbase(height), self.block_time)
block.nVersion = 0x20000000
self.block_time += 1
block.solve()
# Save the coinbase for later
@ -55,6 +56,7 @@ class InvalidTxRequestTest(ComparisonTestFramework): @@ -55,6 +56,7 @@ class InvalidTxRequestTest(ComparisonTestFramework):
test = TestInstance(sync_every_block=False)
for i in range(100):
block = create_block(self.tip, create_coinbase(height), self.block_time)
block.nVersion = 0x20000000
block.solve()
self.tip = block.sha256
self.block_time += 1

8
test/functional/p2p_sendheaders.py

@ -265,6 +265,7 @@ class SendHeadersTest(BitcoinTestFramework): @@ -265,6 +265,7 @@ class SendHeadersTest(BitcoinTestFramework):
self.log.info("Verify getheaders with null locator and invalid hashstop does not return headers.")
block = create_block(int(tip["hash"], 16), create_coinbase(tip["height"] + 1), tip["mediantime"] + 1)
block.nVersion = 0x20000000
block.solve()
test_node.send_header_for_blocks([block])
test_node.clear_last_announcement()
@ -303,6 +304,7 @@ class SendHeadersTest(BitcoinTestFramework): @@ -303,6 +304,7 @@ class SendHeadersTest(BitcoinTestFramework):
last_time = self.nodes[0].getblock(self.nodes[0].getbestblockhash())['time']
block_time = last_time + 1
new_block = create_block(tip, create_coinbase(height + 1), block_time)
new_block.nVersion = 0x20000000
new_block.solve()
test_node.send_header_for_blocks([new_block])
test_node.wait_for_getdata([new_block.sha256])
@ -337,6 +339,7 @@ class SendHeadersTest(BitcoinTestFramework): @@ -337,6 +339,7 @@ class SendHeadersTest(BitcoinTestFramework):
blocks = []
for b in range(i + 1):
blocks.append(create_block(tip, create_coinbase(height), block_time))
blocks[-1].nVersion = 0x20000000
blocks[-1].solve()
tip = blocks[-1].sha256
block_time += 1
@ -449,6 +452,7 @@ class SendHeadersTest(BitcoinTestFramework): @@ -449,6 +452,7 @@ class SendHeadersTest(BitcoinTestFramework):
blocks = []
for b in range(2):
blocks.append(create_block(tip, create_coinbase(height), block_time))
blocks[-1].nVersion = 0x20000000
blocks[-1].solve()
tip = blocks[-1].sha256
block_time += 1
@ -467,6 +471,7 @@ class SendHeadersTest(BitcoinTestFramework): @@ -467,6 +471,7 @@ class SendHeadersTest(BitcoinTestFramework):
blocks = []
for b in range(3):
blocks.append(create_block(tip, create_coinbase(height), block_time))
blocks[-1].nVersion = 0x20000000
blocks[-1].solve()
tip = blocks[-1].sha256
block_time += 1
@ -488,6 +493,7 @@ class SendHeadersTest(BitcoinTestFramework): @@ -488,6 +493,7 @@ class SendHeadersTest(BitcoinTestFramework):
# Create extra blocks for later
for b in range(20):
blocks.append(create_block(tip, create_coinbase(height), block_time))
blocks[-1].nVersion = 0x20000000
blocks[-1].solve()
tip = blocks[-1].sha256
block_time += 1
@ -534,6 +540,7 @@ class SendHeadersTest(BitcoinTestFramework): @@ -534,6 +540,7 @@ class SendHeadersTest(BitcoinTestFramework):
# Create two more blocks.
for j in range(2):
blocks.append(create_block(tip, create_coinbase(height), block_time))
blocks[-1].nVersion = 0x20000000
blocks[-1].solve()
tip = blocks[-1].sha256
block_time += 1
@ -555,6 +562,7 @@ class SendHeadersTest(BitcoinTestFramework): @@ -555,6 +562,7 @@ class SendHeadersTest(BitcoinTestFramework):
MAX_UNCONNECTING_HEADERS = 10
for j in range(MAX_UNCONNECTING_HEADERS + 1):
blocks.append(create_block(tip, create_coinbase(height), block_time))
blocks[-1].nVersion = 0x20000000
blocks[-1].solve()
tip = blocks[-1].sha256
block_time += 1

14
test/functional/p2p_unrequested_blocks.py

@ -60,8 +60,8 @@ from test_framework.blocktools import create_block, create_coinbase, create_tran @@ -60,8 +60,8 @@ from test_framework.blocktools import create_block, create_coinbase, create_tran
class AcceptBlockTest(BitcoinTestFramework):
def add_options(self, parser):
parser.add_option("--testbinary", dest="testbinary",
default=os.getenv("BITCOIND", "bitcoind"),
help="bitcoind binary to test")
default=os.getenv("LITECOIND", "litecoind"),
help="litecoind binary to test")
def set_test_params(self):
self.setup_clean_chain = True
@ -99,6 +99,7 @@ class AcceptBlockTest(BitcoinTestFramework): @@ -99,6 +99,7 @@ class AcceptBlockTest(BitcoinTestFramework):
block_time = int(time.time()) + 1
for i in range(2):
blocks_h2.append(create_block(tips[i], create_coinbase(2), block_time))
blocks_h2[i].nVersion = 0x20000000
blocks_h2[i].solve()
block_time += 1
test_node.send_message(msg_block(blocks_h2[0]))
@ -112,6 +113,7 @@ class AcceptBlockTest(BitcoinTestFramework): @@ -112,6 +113,7 @@ class AcceptBlockTest(BitcoinTestFramework):
# 3. Send another block that builds on genesis.
block_h1f = create_block(int("0x" + self.nodes[0].getblockhash(0), 0), create_coinbase(1), block_time)
block_h1f.nVersion = 0x20000000
block_time += 1
block_h1f.solve()
test_node.send_message(msg_block(block_h1f))
@ -127,6 +129,7 @@ class AcceptBlockTest(BitcoinTestFramework): @@ -127,6 +129,7 @@ class AcceptBlockTest(BitcoinTestFramework):
# 4. Send another two block that build on the fork.
block_h2f = create_block(block_h1f.sha256, create_coinbase(2), block_time)
block_h2f.nVersion = 0x20000000
block_time += 1
block_h2f.solve()
test_node.send_message(msg_block(block_h2f))
@ -147,6 +150,7 @@ class AcceptBlockTest(BitcoinTestFramework): @@ -147,6 +150,7 @@ class AcceptBlockTest(BitcoinTestFramework):
# 4b. Now send another block that builds on the forking chain.
block_h3 = create_block(block_h2f.sha256, create_coinbase(3), block_h2f.nTime+1)
block_h3.nVersion = 0x20000000
block_h3.solve()
test_node.send_message(msg_block(block_h3))
@ -171,6 +175,7 @@ class AcceptBlockTest(BitcoinTestFramework): @@ -171,6 +175,7 @@ class AcceptBlockTest(BitcoinTestFramework):
all_blocks = []
for i in range(288):
next_block = create_block(tip.sha256, create_coinbase(i + 4), tip.nTime+1)
next_block.nVersion = 0x20000000
next_block.solve()
all_blocks.append(next_block)
tip = next_block
@ -249,15 +254,19 @@ class AcceptBlockTest(BitcoinTestFramework): @@ -249,15 +254,19 @@ class AcceptBlockTest(BitcoinTestFramework):
# 8. Create a chain which is invalid at a height longer than the
# current chain, but which has more blocks on top of that
block_289f = create_block(all_blocks[284].sha256, create_coinbase(289), all_blocks[284].nTime+1)
block_289f.nVersion = 0x20000000
block_289f.solve()
block_290f = create_block(block_289f.sha256, create_coinbase(290), block_289f.nTime+1)
block_290f.nVersion = 0x20000000
block_290f.solve()
block_291 = create_block(block_290f.sha256, create_coinbase(291), block_290f.nTime+1)
block_291.nVersion = 0x20000000
# block_291 spends a coinbase below maturity!
block_291.vtx.append(create_transaction(block_290f.vtx[0], 0, b"42", 1))
block_291.hashMerkleRoot = block_291.calc_merkle_root()
block_291.solve()
block_292 = create_block(block_291.sha256, create_coinbase(292), block_291.nTime+1)
block_292.nVersion = 0x20000000
block_292.solve()
# Now send all the headers on the chain and enough blocks to trigger reorg
@ -308,6 +317,7 @@ class AcceptBlockTest(BitcoinTestFramework): @@ -308,6 +317,7 @@ class AcceptBlockTest(BitcoinTestFramework):
# Now send a new header on the invalid chain, indicating we're forked off, and expect to get disconnected
block_293 = create_block(block_292.sha256, create_coinbase(293), block_292.nTime+1)
block_293.nVersion = 0x20000000
block_293.solve()
headers_message = msg_headers()
headers_message.headers.append(CBlockHeader(block_293))

2
test/functional/rpc_rawtransaction.py

@ -85,7 +85,7 @@ class RawTransactionsTest(BitcoinTestFramework): @@ -85,7 +85,7 @@ class RawTransactionsTest(BitcoinTestFramework):
address = self.nodes[0].getnewaddress()
assert_raises_rpc_error(-3, "Expected type object", self.nodes[0].createrawtransaction, [], 'foo')
assert_raises_rpc_error(-8, "Data must be hexadecimal string", self.nodes[0].createrawtransaction, [], {'data': 'foo'})
assert_raises_rpc_error(-5, "Invalid Bitcoin address", self.nodes[0].createrawtransaction, [], {'foo': 0})
assert_raises_rpc_error(-5, "Invalid Litecoin address", self.nodes[0].createrawtransaction, [], {'foo': 0})
assert_raises_rpc_error(-3, "Invalid amount", self.nodes[0].createrawtransaction, [], {address: 'foo'})
assert_raises_rpc_error(-3, "Amount out of range", self.nodes[0].createrawtransaction, [], {address: -1})
assert_raises_rpc_error(-8, "Invalid parameter, duplicated address: %s" % address, self.nodes[0].createrawtransaction, [], multidict([(address, 1), (address, 1)]))

2
test/functional/rpc_signmessage.py

@ -19,7 +19,7 @@ class SignMessagesTest(BitcoinTestFramework): @@ -19,7 +19,7 @@ class SignMessagesTest(BitcoinTestFramework):
self.log.info('test signing with priv_key')
priv_key = 'cUeKHd5orzT3mz8P9pxyREHfsWtVfgsfDjiZZBcjUBAaGk1BTj7N'
address = 'mpLQjfK79b7CCV4VMJWEWAj5Mpx8Up5zxB'
expected_signature = 'INbVnW4e6PeRmsv2Qgu8NuopvrVjkcxob+sX8OcZG0SALhWybUjzMLPdAsXI46YZGb0KQTRii+wWIQzRpG/U+S0='
expected_signature = 'IGve8AOjIcu+a/nYW1PABSfmp2oQlEqLIOwPgNW5/Y5teggr8S0vy4SMdjL2Viv3iuBZjJbhvyBo0tv5m3H63b8='
signature = self.nodes[0].signmessagewithprivkey(priv_key, message)
assert_equal(expected_signature, signature)
assert(self.nodes[0].verifymessage(address, signature, message))

2
test/functional/test_framework/address.py

@ -57,7 +57,7 @@ def program_to_witness(version, program, main = False): @@ -57,7 +57,7 @@ def program_to_witness(version, program, main = False):
assert 0 <= version <= 16
assert 2 <= len(program) <= 40
assert version > 0 or len(program) in [20, 32]
return segwit_addr.encode("bc" if main else "bcrt", version, program)
return segwit_addr.encode("ltc" if main else "rltc", version, program)
def script_to_p2wsh(script, main = False):
script = check_script(script)

2
test/functional/test_framework/coverage.py

@ -76,7 +76,7 @@ def get_filename(dirname, n_node): @@ -76,7 +76,7 @@ def get_filename(dirname, n_node):
def write_all_rpc_commands(dirname, node):
"""
Write out a list of all RPC functions available in `bitcoin-cli` for
Write out a list of all RPC functions available in `litecoin-cli` for
coverage comparison. This will only happen once per coverage
directory.

12
test/functional/test_framework/messages.py

@ -23,11 +23,12 @@ import socket @@ -23,11 +23,12 @@ import socket
import struct
import time
import litecoin_scrypt
from test_framework.siphash import siphash256
from test_framework.util import hex_str_to_bytes, bytes_to_hex_str
MIN_VERSION_SUPPORTED = 60001
MY_VERSION = 70014 # past bip-31 for ping/pong
MY_VERSION = 80014 # past bip-31 for ping/pong
MY_SUBVERSION = b"/python-mininode-tester:0.0.3/"
MY_RELAY = 1 # from version 70001 onwards, fRelay should be appended to version messages (BIP37)
@ -499,6 +500,7 @@ class CBlockHeader(): @@ -499,6 +500,7 @@ class CBlockHeader():
self.nNonce = header.nNonce
self.sha256 = header.sha256
self.hash = header.hash
self.scrypt256 = header.scrypt256
self.calc_sha256()
def set_null(self):
@ -510,6 +512,7 @@ class CBlockHeader(): @@ -510,6 +512,7 @@ class CBlockHeader():
self.nNonce = 0
self.sha256 = None
self.hash = None
self.scrypt256 = None
def deserialize(self, f):
self.nVersion = struct.unpack("<i", f.read(4))[0]
@ -520,6 +523,7 @@ class CBlockHeader(): @@ -520,6 +523,7 @@ class CBlockHeader():
self.nNonce = struct.unpack("<I", f.read(4))[0]
self.sha256 = None
self.hash = None
self.scrypt256 = None
def serialize(self):
r = b""
@ -542,9 +546,11 @@ class CBlockHeader(): @@ -542,9 +546,11 @@ class CBlockHeader():
r += struct.pack("<I", self.nNonce)
self.sha256 = uint256_from_str(hash256(r))
self.hash = encode(hash256(r)[::-1], 'hex_codec').decode('ascii')
self.scrypt256 = uint256_from_str(litecoin_scrypt.getPoWHash(r))
def rehash(self):
self.sha256 = None
self.scrypt256 = None
self.calc_sha256()
return self.sha256
@ -604,7 +610,7 @@ class CBlock(CBlockHeader): @@ -604,7 +610,7 @@ class CBlock(CBlockHeader):
def is_valid(self):
self.calc_sha256()
target = uint256_from_compact(self.nBits)
if self.sha256 > target:
if self.scrypt256 > target:
return False
for tx in self.vtx:
if not tx.is_valid():
@ -616,7 +622,7 @@ class CBlock(CBlockHeader): @@ -616,7 +622,7 @@ class CBlock(CBlockHeader):
def solve(self):
self.rehash()
target = uint256_from_compact(self.nBits)
while self.sha256 > target:
while self.scrypt256 > target:
self.nNonce += 1
self.rehash()

6
test/functional/test_framework/mininode.py

@ -50,8 +50,8 @@ MESSAGEMAP = { @@ -50,8 +50,8 @@ MESSAGEMAP = {
}
MAGIC_BYTES = {
"mainnet": b"\xf9\xbe\xb4\xd9", # mainnet
"testnet3": b"\x0b\x11\x09\x07", # testnet3
"mainnet": b"\xfb\xc0\xb6\xdb", # mainnet
"testnet4": b"\xfd\xd2\xc8\xf1", # testnet3
"regtest": b"\xfa\xbf\xb5\xda", # regtest
}
@ -86,7 +86,7 @@ class P2PConnection(asyncore.dispatcher): @@ -86,7 +86,7 @@ class P2PConnection(asyncore.dispatcher):
self.network = net
self.disconnect = False
logger.info('Connecting to Bitcoin Node: %s:%d' % (self.dstaddr, self.dstport))
logger.info('Connecting to Litecoin Node: %s:%d' % (self.dstaddr, self.dstport))
try:
self.connect((dstaddr, dstport))

40
test/functional/test_framework/test_framework.py

@ -42,9 +42,9 @@ TEST_EXIT_FAILED = 1 @@ -42,9 +42,9 @@ TEST_EXIT_FAILED = 1
TEST_EXIT_SKIPPED = 77
class BitcoinTestFramework():
"""Base class for a bitcoin test script.
"""Base class for a litecoin test script.
Individual bitcoin test scripts should subclass this class and override the set_test_params() and run_test() methods.
Individual litecoin test scripts should subclass this class and override the set_test_params() and run_test() methods.
Individual tests can also override the following methods to customize the test setup:
@ -72,11 +72,11 @@ class BitcoinTestFramework(): @@ -72,11 +72,11 @@ class BitcoinTestFramework():
parser = optparse.OptionParser(usage="%prog [options]")
parser.add_option("--nocleanup", dest="nocleanup", default=False, action="store_true",
help="Leave bitcoinds and test.* datadir on exit or error")
help="Leave litecoinds and test.* datadir on exit or error")
parser.add_option("--noshutdown", dest="noshutdown", default=False, action="store_true",
help="Don't stop bitcoinds after the test execution")
help="Don't stop litecoinds after the test execution")
parser.add_option("--srcdir", dest="srcdir", default=os.path.normpath(os.path.dirname(os.path.realpath(__file__)) + "/../../../src"),
help="Source directory containing bitcoind/bitcoin-cli (default: %default)")
help="Source directory containing litecoind/litecoin-cli (default: %default)")
parser.add_option("--cachedir", dest="cachedir", default=os.path.normpath(os.path.dirname(os.path.realpath(__file__)) + "/../../cache"),
help="Directory for caching pregenerated datadirs")
parser.add_option("--tmpdir", dest="tmpdir", help="Root directory for datadirs")
@ -93,7 +93,7 @@ class BitcoinTestFramework(): @@ -93,7 +93,7 @@ class BitcoinTestFramework():
parser.add_option("--pdbonfailure", dest="pdbonfailure", default=False, action="store_true",
help="Attach a python debugger if test fails")
parser.add_option("--usecli", dest="usecli", default=False, action="store_true",
help="use bitcoin-cli instead of RPC for all commands")
help="use litecoin-cli instead of RPC for all commands")
self.add_options(parser)
(self.options, self.args) = parser.parse_args()
@ -145,7 +145,7 @@ class BitcoinTestFramework(): @@ -145,7 +145,7 @@ class BitcoinTestFramework():
if self.nodes:
self.stop_nodes()
else:
self.log.info("Note: bitcoinds were not stopped and may still be running")
self.log.info("Note: litecoinds were not stopped and may still be running")
if not self.options.nocleanup and not self.options.noshutdown and success != TestStatus.FAILED:
self.log.info("Cleaning up")
@ -221,7 +221,7 @@ class BitcoinTestFramework(): @@ -221,7 +221,7 @@ class BitcoinTestFramework():
self.nodes.append(TestNode(i, self.options.tmpdir, extra_args[i], rpchost, timewait=timewait, binary=binary[i], stderr=None, mocktime=self.mocktime, coverage_dir=self.options.coveragedir, use_cli=self.options.usecli))
def start_node(self, i, *args, **kwargs):
"""Start a bitcoind"""
"""Start a litecoind"""
node = self.nodes[i]
@ -232,7 +232,7 @@ class BitcoinTestFramework(): @@ -232,7 +232,7 @@ class BitcoinTestFramework():
coverage.write_all_rpc_commands(self.options.coveragedir, node.rpc)
def start_nodes(self, extra_args=None, *args, **kwargs):
"""Start multiple bitcoinds"""
"""Start multiple litecoinds"""
if extra_args is None:
extra_args = [None] * self.num_nodes
@ -252,12 +252,12 @@ class BitcoinTestFramework(): @@ -252,12 +252,12 @@ class BitcoinTestFramework():
coverage.write_all_rpc_commands(self.options.coveragedir, node.rpc)
def stop_node(self, i):
"""Stop a bitcoind test node"""
"""Stop a litecoind test node"""
self.nodes[i].stop_node()
self.nodes[i].wait_until_stopped()
def stop_nodes(self):
"""Stop multiple bitcoind test nodes"""
"""Stop multiple litecoind test nodes"""
for node in self.nodes:
# Issue RPC to stop nodes
node.stop_node()
@ -277,7 +277,7 @@ class BitcoinTestFramework(): @@ -277,7 +277,7 @@ class BitcoinTestFramework():
self.start_node(i, extra_args, stderr=log_stderr, *args, **kwargs)
self.stop_node(i)
except Exception as e:
assert 'bitcoind exited' in str(e) # node must have shutdown
assert 'litecoind exited' in str(e) # node must have shutdown
self.nodes[i].running = False
self.nodes[i].process = None
if expected_msg is not None:
@ -287,9 +287,9 @@ class BitcoinTestFramework(): @@ -287,9 +287,9 @@ class BitcoinTestFramework():
raise AssertionError("Expected error \"" + expected_msg + "\" not found in:\n" + stderr)
else:
if expected_msg is None:
assert_msg = "bitcoind should have exited with an error"
assert_msg = "litecoind should have exited with an error"
else:
assert_msg = "bitcoind should have exited with expected error " + expected_msg
assert_msg = "litecoind should have exited with expected error " + expected_msg
raise AssertionError(assert_msg)
def wait_for_node_exit(self, i, timeout):
@ -387,7 +387,7 @@ class BitcoinTestFramework(): @@ -387,7 +387,7 @@ class BitcoinTestFramework():
# Create cache directories, run bitcoinds:
for i in range(MAX_NODES):
datadir = initialize_datadir(self.options.cachedir, i)
args = [os.getenv("BITCOIND", "bitcoind"), "-server", "-keypool=1", "-datadir=" + datadir, "-discover=0"]
args = [os.getenv("LITECOIND", "litecoind"), "-server", "-keypool=1", "-datadir=" + datadir, "-discover=0"]
if i > 0:
args.append("-connect=127.0.0.1:" + str(p2p_port(0)))
self.nodes.append(TestNode(i, self.options.cachedir, extra_args=[], rpchost=None, timewait=None, binary=None, stderr=None, mocktime=self.mocktime, coverage_dir=None))
@ -443,7 +443,7 @@ class BitcoinTestFramework(): @@ -443,7 +443,7 @@ class BitcoinTestFramework():
class ComparisonTestFramework(BitcoinTestFramework):
"""Test framework for doing p2p comparison testing
Sets up some bitcoind binaries:
Sets up some litecoind binaries:
- 1 binary: test binary
- 2 binaries: 1 test binary, 1 ref binary
- n>2 binaries: 1 test binary, n-1 ref binaries"""
@ -454,11 +454,11 @@ class ComparisonTestFramework(BitcoinTestFramework): @@ -454,11 +454,11 @@ class ComparisonTestFramework(BitcoinTestFramework):
def add_options(self, parser):
parser.add_option("--testbinary", dest="testbinary",
default=os.getenv("BITCOIND", "bitcoind"),
help="bitcoind binary to test")
default=os.getenv("LITECOIND", "litecoind"),
help="litecoind binary to test")
parser.add_option("--refbinary", dest="refbinary",
default=os.getenv("BITCOIND", "bitcoind"),
help="bitcoind binary to use for reference nodes (if any)")
default=os.getenv("LITECOIND", "litecoind"),
help="litecoind binary to use for reference nodes (if any)")
def setup_network(self):
extra_args = [['-whitelist=127.0.0.1']] * self.num_nodes

10
test/functional/test_framework/test_node.py

@ -52,7 +52,7 @@ class TestNode(): @@ -52,7 +52,7 @@ class TestNode():
# Wait for up to 60 seconds for the RPC server to respond
self.rpc_timeout = 60
if binary is None:
self.binary = os.getenv("BITCOIND", "bitcoind")
self.binary = os.getenv("LITECOIND", "litecoind")
else:
self.binary = binary
self.stderr = stderr
@ -61,7 +61,7 @@ class TestNode(): @@ -61,7 +61,7 @@ class TestNode():
self.extra_args = extra_args
self.args = [self.binary, "-datadir=" + self.datadir, "-server", "-keypool=1", "-discover=0", "-rest", "-logtimemicros", "-debug", "-debugexclude=libevent", "-debugexclude=leveldb", "-mocktime=" + str(mocktime), "-uacomment=testnode%d" % i]
self.cli = TestNodeCLI(os.getenv("BITCOINCLI", "bitcoin-cli"), self.datadir)
self.cli = TestNodeCLI(os.getenv("LITECOINCLI", "litecoin-cli"), self.datadir)
self.use_cli = use_cli
self.running = False
@ -89,14 +89,14 @@ class TestNode(): @@ -89,14 +89,14 @@ class TestNode():
stderr = self.stderr
self.process = subprocess.Popen(self.args + extra_args, stderr=stderr, *args, **kwargs)
self.running = True
self.log.debug("bitcoind started, waiting for RPC to come up")
self.log.debug("litecoind started, waiting for RPC to come up")
def wait_for_rpc_connection(self):
"""Sets up an RPC connection to the bitcoind process. Returns False if unable to connect."""
# Poll at a rate of four times per second
poll_per_s = 4
for _ in range(poll_per_s * self.rpc_timeout):
assert self.process.poll() is None, "bitcoind exited with status %i during initialization" % self.process.returncode
assert self.process.poll() is None, "litecoind exited with status %i during initialization" % self.process.returncode
try:
self.rpc = get_rpc_proxy(rpc_url(self.datadir, self.index, self.rpchost), self.index, timeout=self.rpc_timeout, coveragedir=self.coverage_dir)
self.rpc.getblockcount()
@ -115,7 +115,7 @@ class TestNode(): @@ -115,7 +115,7 @@ class TestNode():
if "No RPC credentials" not in str(e):
raise
time.sleep(1.0 / poll_per_s)
raise AssertionError("Unable to connect to bitcoind")
raise AssertionError("Unable to connect to litecoind")
def get_wallet_rpc(self, wallet_name):
if self.use_cli:

16
test/functional/test_runner.py

@ -211,7 +211,7 @@ def main(): @@ -211,7 +211,7 @@ def main():
logging.basicConfig(format='%(message)s', level=logging_level)
# Create base test directory
tmpdir = "%s/bitcoin_test_runner_%s" % (args.tmpdirprefix, datetime.datetime.now().strftime("%Y%m%d_%H%M%S"))
tmpdir = "%s/litecoin_test_runner_%s" % (args.tmpdirprefix, datetime.datetime.now().strftime("%Y%m%d_%H%M%S"))
os.makedirs(tmpdir)
logging.debug("Temporary test directory at %s" % tmpdir)
@ -227,7 +227,7 @@ def main(): @@ -227,7 +227,7 @@ def main():
sys.exit(0)
if not (enable_wallet and enable_utils and enable_bitcoind):
print("No functional tests to run. Wallet, utils, and bitcoind must all be enabled")
print("No functional tests to run. Wallet, utils, and litecoind must all be enabled")
print("Rerun `configure` with -enable-wallet, -with-utils and -with-daemon and rerun make")
sys.exit(0)
@ -282,8 +282,8 @@ def main(): @@ -282,8 +282,8 @@ def main():
def run_tests(test_list, src_dir, build_dir, exeext, tmpdir, jobs=1, enable_coverage=False, args=[], combined_logs_len=0):
# Warn if bitcoind is already running (unix only)
try:
if subprocess.check_output(["pidof", "bitcoind"]) is not None:
print("%sWARNING!%s There is already a bitcoind process running on this system. Tests may fail unexpectedly due to resource contention!" % (BOLD[1], BOLD[0]))
if subprocess.check_output(["pidof", "litecoind"]) is not None:
print("%sWARNING!%s There is already a litecoind process running on this system. Tests may fail unexpectedly due to resource contention!" % (BOLD[1], BOLD[0]))
except (OSError, subprocess.SubprocessError):
pass
@ -293,9 +293,9 @@ def run_tests(test_list, src_dir, build_dir, exeext, tmpdir, jobs=1, enable_cove @@ -293,9 +293,9 @@ def run_tests(test_list, src_dir, build_dir, exeext, tmpdir, jobs=1, enable_cove
print("%sWARNING!%s There is a cache directory here: %s. If tests fail unexpectedly, try deleting the cache directory." % (BOLD[1], BOLD[0], cache_dir))
#Set env vars
if "BITCOIND" not in os.environ:
os.environ["BITCOIND"] = build_dir + '/src/bitcoind' + exeext
os.environ["BITCOINCLI"] = build_dir + '/src/bitcoin-cli' + exeext
if "LITECOIND" not in os.environ:
os.environ["LITECOIND"] = build_dir + '/src/litecoind' + exeext
os.environ["LITECOINCLI"] = build_dir + '/src/litecoin-cli' + exeext
tests_dir = src_dir + '/test/functional/'
@ -510,7 +510,7 @@ class RPCCoverage(): @@ -510,7 +510,7 @@ class RPCCoverage():
Coverage calculation works by having each test script subprocess write
coverage files into a particular directory. These files contain the RPC
commands invoked during testing, as well as a complete listing of RPC
commands per `bitcoin-cli help` (`rpc_interface.txt`).
commands per `litecoin-cli help` (`rpc_interface.txt`).
After all tests complete, the commands run are combined and diff'd against
the complete list to calculate uncovered RPC commands.

6
test/util/data/bitcoin-util-test.json

@ -268,7 +268,7 @@ @@ -268,7 +268,7 @@
"error_txt": "error: Uncompressed pubkeys are not useable for SegWit outputs",
"description": "Creates a new transaction with a single pay-to-pub-key output, wrapped in P2SH (output as json)"
},
{ "exec": "./bitcoin-tx",
{ "exec": "./litecoin-tx",
"args":
["-create",
"in=69e9c12d30a6cd598a31ddfcaabeb9d9f0baf8938bf0ba6610beb04f589cc5ef:0",
@ -396,12 +396,12 @@ @@ -396,12 +396,12 @@
"output_cmp": "txcreatemultisig4.json",
"description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output, wrapped in P2SH (output in json)"
},
{ "exec": "./bitcoin-tx",
{ "exec": "./litecoin-tx",
"args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:047d1368ba7ae01c94bc32293efd70bd7e3be7aa7912d07d0b1c659c1008d179b8642f5fb90f47580feb29f045e216ff5a4716d3a0fed36da414d332046303c44a:S"],
"output_cmp": "txcreatemultisig5.json",
"description": "Uncompressed pubkeys should work just fine for non-witness outputs"
},
{ "exec": "./bitcoin-tx",
{ "exec": "./litecoin-tx",
"args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:047d1368ba7ae01c94bc32293efd70bd7e3be7aa7912d07d0b1c659c1008d179b8642f5fb90f47580feb29f045e216ff5a4716d3a0fed36da414d332046303c44a:WS"],
"return_code": 1,
"error_txt": "error: Uncompressed pubkeys are not useable for SegWit outputs",

4
test/util/data/txcreatemultisig1.json

@ -17,8 +17,8 @@ @@ -17,8 +17,8 @@
"reqSigs": 2,
"type": "multisig",
"addresses": [
"La2DHFRvKvGwR78JkkMCzEw6BJUrSQa72A",
"LZkrFMdJCxcpf2fSorE4MJHUNZGfAnD7gf",
"La2DHFRvKvGwR78JkkMCzEw6BJUrSQa72A",
"LZkrFMdJCxcpf2fSorE4MJHUNZGfAnD7gf",
"LNZrr8v1gBobYuA3ABbTkRnuf7n5RRo5Cz"
]
}

2
test/util/data/txcreatemultisig2.json

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
"reqSigs": 1,
"type": "scripthash",
"addresses": [
"MAVWzxXm8KGkZTesqLtqywzrvbs96FEoKy"
"34HNh57oBCRKkxNyjTuWAJkTbuGh6jg2Ms"
]
}
}

2
test/util/data/txcreatemultisig3.json

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
"reqSigs": 1,
"type": "witness_v0_scripthash",
"addresses": [
"bc1qu9dgdg330r6r84g5mw7wqshg04exv2uttmw2elfwx74h5tgntuzs44gyfg"
"ltc1qu9dgdg330r6r84g5mw7wqshg04exv2uttmw2elfwx74h5tgntuzsk3x5nd"
]
}
}

2
test/util/data/txcreatemultisig4.json

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
"reqSigs": 1,
"type": "scripthash",
"addresses": [
"MJ1PnsRQqxToRBkMf74x1etf2c8i2imj3Y"
"3BoFUz1StqcNcgUTZE5cC1eFhuYFzj3fGH"
]
}
}

2
test/util/data/txcreateoutpubkey2.json

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
"reqSigs": 1,
"type": "witness_v0_keyhash",
"addresses": [
"bc1q5fgkuac9s2ry56jka5s6zqsyfcugcchry5cwu0"
"ltc1q5fgkuac9s2ry56jka5s6zqsyfcugcchrqgz2yl"
]
}
}

2
test/util/data/txcreateoutpubkey3.json

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
"reqSigs": 1,
"type": "scripthash",
"addresses": [
"MP18g1foe3PhM8ydEFVSJ2DMpcdvhLebXR"
"3GnzN8FqgvYGYdhj8NW6UNxxVv3Uj1ApQn"
]
}
}

2
test/util/data/txcreatescript2.json

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
"reqSigs": 1,
"type": "scripthash",
"addresses": [
"MJHYtjeEeGX586VC9HahUfnn4UxFmqozk8"
"3C5QarEGh9feKbDJ3QbMf2YNjnMoiPDhNp"
]
}
}

2
test/util/data/txcreatescript3.json

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
"reqSigs": 1,
"type": "witness_v0_scripthash",
"addresses": [
"bc1qp0lfxhnscvsu0j36l36uurgv5tuck4pzuqytkvwqp3kh78cupttqyf705v"
"ltc1qp0lfxhnscvsu0j36l36uurgv5tuck4pzuqytkvwqp3kh78cupttq8dslwf"
]
}
}

2
test/util/data/txcreatescript4.json

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
"reqSigs": 1,
"type": "scripthash",
"addresses": [
"MHaYuXfcFR7myUVrVpVjjVCngZLKDuRbn3"
"3BNQbeFeJJGMAyDxPwWPuqxPMrjsFLjk3f"
]
}
}

4
test/util/data/txcreatesignv1.json

@ -2,8 +2,8 @@ @@ -2,8 +2,8 @@
"txid": "bf7c8b55745d4f9d9b2e33b5fbec5d08e38f3dcfc1838cb424a16db3ebc52f13",
"hash": "bf7c8b55745d4f9d9b2e33b5fbec5d08e38f3dcfc1838cb424a16db3ebc52f13",
"version": 1,
"size": 224,
"vsize": 224,
"size": 85,
"vsize": 85,
"locktime": 0,
"vin": [
{

Loading…
Cancel
Save