practicalswift
49de096c2a
Remove unused Boost includes
8 years ago
Andrew Chow
ac4e438229
Sanity check transaction scripts in DecodeHexTx
...
Make sure that the scripts of decoded transactions are valid scripts.
8 years ago
Andrew Chow
5b75c47784
Add a valid opcode sanity check to CScript
...
Added a function in CScript that checks if the script contains valid opcodes.
Add a test for that function
8 years ago
Pieter Wuille
e945848582
scripted-diff: Use new naming style for insecure_rand* functions
...
-BEGIN VERIFY SCRIPT-
sed -i 's/\<insecure_randbits(/InsecureRandBits(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_randbool(/InsecureRandBool(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_randrange(/InsecureRandRange(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_randbytes(/InsecureRandBytes(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_rand256(/InsecureRand256(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_rand(/InsecureRand32(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<seed_insecure_rand(/SeedInsecureRand(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
-END VERIFY SCRIPT-
8 years ago
practicalswift
0abc58890c
[tests] Remove printf(...)
8 years ago
practicalswift
227ae9b34d
[tests] Use FastRandomContext instead of boost::random::{mt19937,uniform_int_distribution}
8 years ago
Pieter Wuille
2fcd9cc86b
scripted-diff: Use randbits/bool instead of randrange where possible
...
-BEGIN VERIFY SCRIPT-
sed -i 's/insecure_randbits(1)/insecure_randbool()/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(2)/insecure_randbool()/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(4)/insecure_randbits(2)/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(32)/insecure_randbits(5)/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(256)/insecure_randbits(8)/g' src/test/*_tests.cpp
-END VERIFY SCRIPT-
8 years ago
Pieter Wuille
2ada678521
Use randbits instead of ad-hoc emulation in prevector tests
8 years ago
Pieter Wuille
5f0b04eedc
Replace rand() & ((1 << N) - 1) with randbits(N)
8 years ago
Pieter Wuille
3ecabae363
Replace more rand() % NUM by randranges
8 years ago
practicalswift
246a02fb14
Use std::unordered_{map,set} (C++11) instead of boost::unordered_{map,set}
8 years ago
practicalswift
3fb81a8480
Use list initialization (C++11) for maps/vectors instead of boost::assign::map_list_of/list_of
8 years ago
Mario Dian
24980a3e40
Make functions in validation.cpp static and pass chainparams
...
Fix bugs as per PR comment
Change bool static to static bool
8 years ago
practicalswift
b083db617a
[trivial] Fix typo: "occurrences" (misspelled as "occurrances")
...
Typo introduced in 000391132608343c66488d62625c714814959bc9:
$ git blame src/coins.cpp | grep occurrances
00039113
(2017-04-25 11:29:29 -0700 89) // deal with the pre-BIP30 occurrances of duplicate coinbase transactions.
8 years ago
Luke Dashjr
9a5a1d7d45
RPC/rawtransaction: createrawtransaction: Check opt_into_rbf when provided with either value
8 years ago
Luke Dashjr
23b0fe34f5
bitcoin-tx: rbfoptin: Avoid touching nSequence if the value is already opting in
8 years ago
Luke Dashjr
b005bf21a7
Introduce MAX_BIP125_RBF_SEQUENCE constant
8 years ago
Jonas Schnelli
575cde4605
[bitcoin-tx] add rbfoptin command
8 years ago
Luke Dashjr
36bcab2356
RPC/Wallet: Add RBF support for fundrawtransaction
8 years ago
Luke Dashjr
891c5eeec2
Wallet: Refactor FundTransaction to accept parameters via CCoinControl
8 years ago
Luke Dashjr
578ec80d4f
RPC: rawtransaction: Add RBF support for createrawtransaction
8 years ago
Suhas Daftuar
76f74811c4
Add timeout for headers sync
...
At startup, we choose one peer to serve us the headers chain, until
our best header is close to caught up. Disconnect this peer if more
than 15 minutes + 1ms/expected_header passes and our best header
is still more than 1 day away from current time.
8 years ago
Pieter Wuille
efee1db21a
scripted-diff: use insecure_rand256/randrange more
...
-BEGIN VERIFY SCRIPT-
sed -i "s/\<GetRandHash(/insecure_rand256(/" src/test/*_tests.cpp
sed -i "s/\<GetRand(/insecure_randrange(/" src/test/*_tests.cpp src/test/test_bitcoin.cpp
sed -i 's/\<insecure_rand() % \([0-9]\+\)/insecure_randrange(\1)/g' src/test/*_tests.cpp
-END VERIFY SCRIPT-
8 years ago
Pieter Wuille
1119927df0
Add various insecure_rand wrappers for tests
8 years ago
Pieter Wuille
124d13a58c
Merge test_random.h into test_bitcoin.h
8 years ago
Pieter Wuille
90620d66c9
scripted-diff: Rename cuckoo tests' local rand context
...
-BEGIN VERIFY SCRIPT-
sed -i 's/insecure_rand/local_rand_ctx/g' src/test/cuckoocache_tests.cpp
-END VERIFY SCRIPT-
8 years ago
Pieter Wuille
37e864eb9f
Add FastRandomContext::rand256() and ::randbytes()
...
FastRandomContext now provides all functionality that the real Rand* functions
provide.
8 years ago
Pieter Wuille
8b22af3ee5
Replace bytes_serialized with bogosize
8 years ago
Wladimir J. van der Laan
a7e3c2814c
rpc: Add listen address to incoming connections in `getpeerinfo`
...
This adds the listening address on which incoming connections were received to the
CNode and CNodeStats structures.
The address is reported in `getpeerinfo`.
This can be useful for distinguishing connections received on different listening ports
(e.g. when using a different listening port for Tor hidden service connections)
or different networks.
8 years ago
practicalswift
656dbd871a
Perform member initialization in initialization lists where possible
8 years ago
practicalswift
a8c09affce
Remove unused variables
8 years ago
Pieter Wuille
9aa215bff9
Bugfixes: missing == 0 after randrange
8 years ago
Pieter Wuille
589827975f
scripted-diff: various renames for per-utxo consistency
...
Thanks to John Newberry for pointing these out.
-BEGIN VERIFY SCRIPT-
sed -i 's/\<GetCoins\>/GetCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<HaveCoins\>/HaveCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<HaveCoinsInCache\>/HaveCoinInCache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<IsPruned\>/IsSpent/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<FetchCoins\>/FetchCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<CoinsEntry\>/CoinEntry/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<vHashTxnToUncache\>/coins_to_uncache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<vHashTxToUncache\>/coins_to_uncache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<fHadTxInCache\>/had_coin_in_cache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<coinbaseids\>/coinbase_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<disconnectedids\>/disconnected_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<duplicateids\>/duplicate_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<oldcoins\>/old_coin/g' src/test/coins_tests.cpp
sed -i 's/\<origcoins\>/orig_coin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
-END VERIFY SCRIPT-
8 years ago
Pieter Wuille
73de2c1ff3
Rename CCoinsCacheEntry::coins to coin
8 years ago
Pieter Wuille
119e552f7c
Merge CCoinsViewCache's GetOutputFor and AccessCoin
...
They're doing the same thing now.
8 years ago
Pieter Wuille
580b023092
[MOVEONLY] Move old CCoins class to txdb.cpp
...
It's only used for upgrading from the old database anymore.
8 years ago
Pieter Wuille
8b25d2c0ce
Upgrade from per-tx database to per-txout
8 years ago
Pieter Wuille
b2af357f39
Reduce reserved memory space for flushing
...
As the maximum amount of data that can be pulled into the cache due to
a block validation is much lower now (at most one CCoin entry per input
and per output), reduce the conservative estimate used to determine
flushing time.
8 years ago
Pieter Wuille
41aa5b79a3
Pack Coin more tightly
8 years ago
Pieter Wuille
97072d6685
Remove unused CCoins methods
8 years ago
Pieter Wuille
ce23efaa5c
Extend coins_tests
8 years ago
Pieter Wuille
5083079688
Switch CCoinsView and chainstate db from per-txid to per-txout
...
This patch makes several related changes:
* Changes the CCoinsView virtual methods (GetCoins, HaveCoins, ...)
to be COutPoint/Coin-based rather than txid/CCoins-based.
* Changes the chainstate db to a new incompatible format that is also
COutPoint/Coin based.
* Implements reconstruction code for hash_serialized_2.
* Adapts the coins_tests unit tests (thanks to Russell Yanofsky).
A side effect of the new CCoinsView model is that we can no longer
use the (unreliable) test for transaction outputs in the UTXO set
to determine whether we already have a particular transaction.
8 years ago
Pieter Wuille
4ec0d9e794
Refactor GetUTXOStats in preparation for per-COutPoint iteration
8 years ago
Pieter Wuille
13870b56fc
Replace CCoins-based CTxMemPool::pruneSpent with isSpent
8 years ago
Pieter Wuille
05293f3cb7
Remove ModifyCoins/ModifyNewCoins
8 years ago
Pieter Wuille
961e483979
Switch tests from ModifyCoins to AddCoin/SpendCoin
8 years ago
Russell Yanofsky
8906a9a0d2
Fix bumpfee test after #10449
...
Failure reported by Jorge Timón <jtimon@jtimon.cc>
https://github.com/bitcoin/bitcoin/pull/10449#issuecomment-305556569
8 years ago
Pieter Wuille
8b3868c1b4
Switch CScriptCheck to use Coin instead of CCoins
8 years ago
Matt Corallo
c87b957a32
Only pass things committed to by tx's witness hash to CScriptCheck
...
This clarifies a bit more the ways in which the new script execution
cache could break consensus in the future if additional data from
the CCoins object were to be used as a part of script execution.
After this change, any such consensus breaks should be very visible
to reviewers, hopefully ensuring no such changes can be made.
8 years ago
Pieter Wuille
f68cdfe92b
Switch from per-tx to per-txout CCoinsViewCache methods in some places
8 years ago