MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / equals

Method equals

src/thinblock.cpp:78–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78bool ThinTx::equals(const ThinTx& b) const {
79
80 const bool indeterminate = false; //< can't know if txs equal or not
81
82 if (isNull() && b.isNull())
83 return true;
84
85 if (isNull() || b.isNull())
86 return false;
87
88 if (hasFull() && b.hasFull())
89 return full() == b.full();
90
91 if (hasCheap() && b.hasCheap())
92 return cheap() == b.cheap();
93
94 if (hasObfuscated() && b.hasFull())
95 return obfuscated_.id == GetShortID(
96 obfuscated_.idk0, obfuscated_.idk1, b.full());
97
98 if (hasFull() && b.hasObfuscated())
99 return b.obfuscated_.id == GetShortID(
100 b.obfuscated_.idk0, b.obfuscated_.idk1, full());
101
102 if (hasObfuscated() && b.hasObfuscated()) {
103
104 if (obfuscated_.idk0 != b.obfuscated_.idk0)
105 return indeterminate;
106
107 if (obfuscated_.idk1 != b.obfuscated_.idk1)
108 return indeterminate;
109
110 return obfuscated_.id == b.obfuscated_.id;
111 }
112
113 if (hasObfuscated() || b.hasObfuscated())
114 return indeterminate;
115
116 assert(!"ThinTx::equals");
117}
118
119bool ThinTx::equals(const uint256& b) const {
120 return equals(ThinTx(b));

Callers 6

addTransactionMethod · 0.80
operator()Method · 0.80
lookupMethod · 0.80
operator()Method · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 6

GetShortIDFunction · 0.85
hasFullMethod · 0.80
hasCheapMethod · 0.80
hasObfuscatedMethod · 0.80
ThinTxClass · 0.70
isNullMethod · 0.45

Tested by 3

operator()Method · 0.64
BOOST_AUTO_TEST_CASEFunction · 0.64
BOOST_AUTO_TEST_CASEFunction · 0.64