mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
Use arith_uint256 where necessary
Also add conversion from/to uint256 where needed.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "serialize.h"
|
||||
#include "streams.h"
|
||||
#include "uint256.h"
|
||||
#include "arith_uint256.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <vector>
|
||||
@@ -22,8 +23,7 @@ public:
|
||||
void Damage() {
|
||||
unsigned int n = rand() % vHash.size();
|
||||
int bit = rand() % 256;
|
||||
uint256 &hash = vHash[n];
|
||||
hash ^= ((uint256)1 << bit);
|
||||
*(vHash[n].begin() + (bit>>3)) ^= 1<<(bit&7);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -107,7 +107,13 @@ BOOST_AUTO_TEST_CASE(pmt_test1)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(pmt_malleability)
|
||||
{
|
||||
std::vector<uint256> vTxid = boost::assign::list_of(1)(2)(3)(4)(5)(6)(7)(8)(9)(10)(9)(10);
|
||||
std::vector<uint256> vTxid = boost::assign::list_of
|
||||
(ArithToUint256(1))(ArithToUint256(2))
|
||||
(ArithToUint256(3))(ArithToUint256(4))
|
||||
(ArithToUint256(5))(ArithToUint256(6))
|
||||
(ArithToUint256(7))(ArithToUint256(8))
|
||||
(ArithToUint256(9))(ArithToUint256(10))
|
||||
(ArithToUint256(9))(ArithToUint256(10));
|
||||
std::vector<bool> vMatch = boost::assign::list_of(false)(false)(false)(false)(false)(false)(false)(false)(false)(true)(true)(false);
|
||||
|
||||
CPartialMerkleTree tree(vTxid, vMatch);
|
||||
|
||||
Reference in New Issue
Block a user