Skip to content

Commit 45c06d2

Browse files
committed
Fix Travis builds
1 parent 738a3c9 commit 45c06d2

File tree

5 files changed

+100
-89
lines changed

5 files changed

+100
-89
lines changed

.travis/test_06_script_a.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fi
7171

7272
if [ "$RUN_FEDPEG_BITCOIND_TEST" = "true" ]; then
7373
BEGIN_FOLD fedpeg-bitcoind-test
74-
BITCOIND_VERSION=0.17.1
74+
BITCOIND_VERSION=0.18.0
7575
BITCOIND_ARCH=x86_64-linux-gnu
7676
DOCKER_EXEC curl -O https://bitcoincore.org/bin/bitcoin-core-$BITCOIND_VERSION/bitcoin-$BITCOIND_VERSION-$BITCOIND_ARCH.tar.gz
7777
DOCKER_EXEC tar -zxf bitcoin-$BITCOIND_VERSION-$BITCOIND_ARCH.tar.gz

.travis/test_06_script_b.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
export LC_ALL=C.UTF-8
88

9-
cd "build/bitcoin-$HOST" || (echo "could not enter distdir build/bitcoin-$HOST"; exit 1)
9+
cd "build/elements-$HOST" || (echo "could not enter distdir build/bitcoin-$HOST"; exit 1)
1010

1111
if [ "$RUN_UNIT_TESTS" = "true" ]; then
1212
BEGIN_FOLD unit-tests

src/qt/walletmodel.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ SendAssetsRecipient::SendAssetsRecipient(SendCoinsRecipient r) :
3939
asset(Params().GetConsensus().pegged_asset),
4040
asset_amount(r.amount),
4141
message(r.message),
42+
#ifdef ENABLE_BIP70
4243
paymentRequest(r.paymentRequest),
44+
#else
45+
sPaymentRequest(r.sPaymentRequest),
46+
#endif
4347
authenticatedMerchant(r.authenticatedMerchant),
4448
fSubtractFeeFromAmount(r.fSubtractFeeFromAmount)
4549
{

src/qt/walletmodel.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,14 @@ class SendAssetsRecipient
133133
CAmount asset_amount;
134134
QString message;
135135

136+
#ifdef ENABLE_BIP70
137+
// If from a payment request, paymentRequest.IsInitialized() will be true
136138
PaymentRequestPlus paymentRequest;
139+
#else
140+
// If building with BIP70 is disabled, keep the payment request around as
141+
// serialized string to ensure load/store is lossless
142+
std::string sPaymentRequest;
143+
#endif
137144
QString authenticatedMerchant;
138145

139146
bool fSubtractFeeFromAmount; // memory only

src/test/mempool_tests.cpp

Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -420,93 +420,6 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
420420
CheckSort<ancestor_score>(pool, sortedOrder);
421421
}
422422

423-
// ELEMENTS:
424-
BOOST_AUTO_TEST_CASE(PeginSpentTest)
425-
{
426-
CBlockPolicyEstimator feeEst;
427-
CTxMemPool pool(&feeEst);
428-
LOCK(pool.cs);
429-
430-
std::set<std::pair<uint256, COutPoint> > setPeginsSpent;
431-
TestMemPoolEntryHelper entry;
432-
433-
std::pair<uint256, COutPoint> pegin1, pegin2, pegin3;
434-
GetRandBytes(pegin1.first.begin(), pegin1.first.size());
435-
GetRandBytes(pegin2.first.begin(), pegin2.first.size());
436-
GetRandBytes(pegin3.first.begin(), pegin3.first.size());
437-
GetRandBytes(pegin1.second.hash.begin(), pegin1.second.hash.size());
438-
GetRandBytes(pegin2.second.hash.begin(), pegin2.second.hash.size());
439-
pegin3.second.hash = pegin2.second.hash;
440-
pegin1.second.n = 0;
441-
pegin2.second.n = 0;
442-
pegin3.second.n = 1;
443-
444-
CMutableTransaction tx;
445-
tx.vin.resize(1);
446-
tx.vout.resize(1);
447-
tx.vout[0].nValue = 0;
448-
pool.addUnchecked(entry.PeginsSpent(setPeginsSpent).FromTx(tx));
449-
BOOST_CHECK(pool.mapPeginsSpentToTxid.empty());
450-
451-
setPeginsSpent = {pegin1};
452-
GetRandBytes(tx.vin[0].prevout.hash.begin(), tx.vin[0].prevout.hash.size());
453-
tx.vout.resize(2);
454-
tx.vout[1].nValue = 0;
455-
const uint256 tx2Hash(tx.GetHash());
456-
pool.addUnchecked(entry.PeginsSpent(setPeginsSpent).FromTx(tx));
457-
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin1].ToString(), tx2Hash.ToString());
458-
459-
setPeginsSpent = {pegin2};
460-
GetRandBytes(tx.vin[0].prevout.hash.begin(), tx.vin[0].prevout.hash.size());
461-
tx.vout.resize(3);
462-
tx.vout[2].nValue = 0;
463-
const uint256 tx3Hash(tx.GetHash());
464-
pool.addUnchecked(entry.PeginsSpent(setPeginsSpent).FromTx(tx));
465-
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin2].ToString(), tx3Hash.ToString());
466-
467-
setPeginsSpent = {pegin3};
468-
GetRandBytes(tx.vin[0].prevout.hash.begin(), tx.vin[0].prevout.hash.size());
469-
tx.vout.resize(4);
470-
tx.vout[3].nValue = 0;
471-
CTransactionRef txref(MakeTransactionRef(tx));
472-
pool.removeForBlock({txref}, 1, setPeginsSpent);
473-
474-
BOOST_CHECK_EQUAL(pool.size(), 3);
475-
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid.size(), 2);
476-
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin1].ToString(), tx2Hash.ToString());
477-
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin2].ToString(), tx3Hash.ToString());
478-
479-
setPeginsSpent = {pegin1};
480-
GetRandBytes(tx.vin[0].prevout.hash.begin(), tx.vin[0].prevout.hash.size());
481-
tx.vout.resize(5);
482-
tx.vout[4].nValue = 0;
483-
txref = MakeTransactionRef(tx);
484-
pool.removeForBlock({txref}, 2, setPeginsSpent);
485-
486-
BOOST_CHECK_EQUAL(pool.size(), 2);
487-
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid.size(), 1);
488-
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin2].ToString(), tx3Hash.ToString());
489-
490-
setPeginsSpent = {pegin1, pegin3};
491-
GetRandBytes(tx.vin[0].prevout.hash.begin(), tx.vin[0].prevout.hash.size());
492-
tx.vout.resize(6);
493-
tx.vout[5].nValue = 0;
494-
const uint256 tx4Hash(tx.GetHash());
495-
pool.addUnchecked(entry.PeginsSpent(setPeginsSpent).FromTx(tx));
496-
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin1].ToString(), tx4Hash.ToString());
497-
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin3].ToString(), tx4Hash.ToString());
498-
499-
setPeginsSpent = {pegin2, pegin3};
500-
GetRandBytes(tx.vin[0].prevout.hash.begin(), tx.vin[0].prevout.hash.size());
501-
tx.vout.resize(7);
502-
tx.vout[6].nValue = 0;
503-
txref = MakeTransactionRef(tx);
504-
pool.removeForBlock({txref}, 3, setPeginsSpent);
505-
506-
BOOST_CHECK_EQUAL(pool.size(), 1);
507-
BOOST_CHECK(pool.mapPeginsSpentToTxid.empty());
508-
}
509-
510423
BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
511424
{
512425
CTxMemPool pool;
@@ -838,4 +751,91 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
838751
BOOST_CHECK_EQUAL(descendants, 6ULL);
839752
}
840753

754+
// ELEMENTS:
755+
BOOST_AUTO_TEST_CASE(PeginSpentTest)
756+
{
757+
CBlockPolicyEstimator feeEst;
758+
CTxMemPool pool(&feeEst);
759+
LOCK2(cs_main, pool.cs);
760+
761+
std::set<std::pair<uint256, COutPoint> > setPeginsSpent;
762+
TestMemPoolEntryHelper entry;
763+
764+
std::pair<uint256, COutPoint> pegin1, pegin2, pegin3;
765+
GetRandBytes(pegin1.first.begin(), pegin1.first.size());
766+
GetRandBytes(pegin2.first.begin(), pegin2.first.size());
767+
GetRandBytes(pegin3.first.begin(), pegin3.first.size());
768+
GetRandBytes(pegin1.second.hash.begin(), pegin1.second.hash.size());
769+
GetRandBytes(pegin2.second.hash.begin(), pegin2.second.hash.size());
770+
pegin3.second.hash = pegin2.second.hash;
771+
pegin1.second.n = 0;
772+
pegin2.second.n = 0;
773+
pegin3.second.n = 1;
774+
775+
CMutableTransaction tx;
776+
tx.vin.resize(1);
777+
tx.vout.resize(1);
778+
tx.vout[0].nValue = 0;
779+
pool.addUnchecked(entry.PeginsSpent(setPeginsSpent).FromTx(tx));
780+
BOOST_CHECK(pool.mapPeginsSpentToTxid.empty());
781+
782+
setPeginsSpent = {pegin1};
783+
GetRandBytes(tx.vin[0].prevout.hash.begin(), tx.vin[0].prevout.hash.size());
784+
tx.vout.resize(2);
785+
tx.vout[1].nValue = 0;
786+
const uint256 tx2Hash(tx.GetHash());
787+
pool.addUnchecked(entry.PeginsSpent(setPeginsSpent).FromTx(tx));
788+
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin1].ToString(), tx2Hash.ToString());
789+
790+
setPeginsSpent = {pegin2};
791+
GetRandBytes(tx.vin[0].prevout.hash.begin(), tx.vin[0].prevout.hash.size());
792+
tx.vout.resize(3);
793+
tx.vout[2].nValue = 0;
794+
const uint256 tx3Hash(tx.GetHash());
795+
pool.addUnchecked(entry.PeginsSpent(setPeginsSpent).FromTx(tx));
796+
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin2].ToString(), tx3Hash.ToString());
797+
798+
setPeginsSpent = {pegin3};
799+
GetRandBytes(tx.vin[0].prevout.hash.begin(), tx.vin[0].prevout.hash.size());
800+
tx.vout.resize(4);
801+
tx.vout[3].nValue = 0;
802+
CTransactionRef txref(MakeTransactionRef(tx));
803+
pool.removeForBlock({txref}, 1, setPeginsSpent);
804+
805+
BOOST_CHECK_EQUAL(pool.size(), 3);
806+
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid.size(), 2);
807+
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin1].ToString(), tx2Hash.ToString());
808+
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin2].ToString(), tx3Hash.ToString());
809+
810+
setPeginsSpent = {pegin1};
811+
GetRandBytes(tx.vin[0].prevout.hash.begin(), tx.vin[0].prevout.hash.size());
812+
tx.vout.resize(5);
813+
tx.vout[4].nValue = 0;
814+
txref = MakeTransactionRef(tx);
815+
pool.removeForBlock({txref}, 2, setPeginsSpent);
816+
817+
BOOST_CHECK_EQUAL(pool.size(), 2);
818+
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid.size(), 1);
819+
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin2].ToString(), tx3Hash.ToString());
820+
821+
setPeginsSpent = {pegin1, pegin3};
822+
GetRandBytes(tx.vin[0].prevout.hash.begin(), tx.vin[0].prevout.hash.size());
823+
tx.vout.resize(6);
824+
tx.vout[5].nValue = 0;
825+
const uint256 tx4Hash(tx.GetHash());
826+
pool.addUnchecked(entry.PeginsSpent(setPeginsSpent).FromTx(tx));
827+
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin1].ToString(), tx4Hash.ToString());
828+
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin3].ToString(), tx4Hash.ToString());
829+
830+
setPeginsSpent = {pegin2, pegin3};
831+
GetRandBytes(tx.vin[0].prevout.hash.begin(), tx.vin[0].prevout.hash.size());
832+
tx.vout.resize(7);
833+
tx.vout[6].nValue = 0;
834+
txref = MakeTransactionRef(tx);
835+
pool.removeForBlock({txref}, 3, setPeginsSpent);
836+
837+
BOOST_CHECK_EQUAL(pool.size(), 1);
838+
BOOST_CHECK(pool.mapPeginsSpentToTxid.empty());
839+
}
840+
841841
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)