aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2017-02-13net: require a verack before responding to anything elseCory Fields
7a8c251901 made this logic hard to follow. After that change, messages would not be sent to a peer via SendMessages() before the handshake was complete, but messages could still be sent as a response to an incoming message. For example, if a peer had not yet sent a verack, we wouldn't notify it about new blocks, but we would respond to a PING with a PONG. This change makes the behavior straightforward: until we've received a verack, never send any message other than version/verack/reject. The behavior until a VERACK is received has always been undefined, this change just tightens our policy. This also makes testing much easier, because we can now connect but not send version/verack, and anything sent to us is an error.
2017-02-13net: parse reject earlierCory Fields
Prior to this change, all messages were ignored until a VERSION message was received, as well as possibly incurring a ban score. Since REJECT messages can be sent at any time (including as a response to a bad VERSION message), make sure to always parse them. Moving this parsing up keeps it from being caught in the if (pfrom->nVersion == 0) check below.
2017-02-13net: correctly ban before the handshake is completeCory Fields
7a8c251901 made a change to avoid getting into SendMessages() until the version handshake (VERSION + VERACK) is complete. That was done to avoid leaking out messages to nodes who could connect, but never bothered sending us their version/verack. Unfortunately, the ban tally and possible disconnect are done as part of SendMessages(). So after 7a8c251901, if a peer managed to do something bannable before completing the handshake (say send 100 non-version messages before their version), they wouldn't actually end up getting disconnected/banned. That's fixed here by checking the banscore as part of ProcessMessages() in addition to SendMessages().
2017-02-07bench: Fix initialization order in registrationWladimir J. van der Laan
The initialization order of global data structures in different implementation units is undefined. Making use of this is essentially gambling on what the linker does, the so-called [Static initialization order fiasco](https://isocpp.org/wiki/faq/ctors#static-init-order). In this case it apparently worked on Linux but failed on OpenBSD and FreeBSD. To create it on first use, make the registration structure local to a function. Fixes #8910.
2017-02-07Merge #9532: Remove unused variablesWladimir J. van der Laan
90fd29b Remove unused int64_t nSinceLastSeen (practicalswift) ac4a095 Remove unused Python variables (practicalswift)
2017-02-07Merge #9604: [Trivial] add comment about setting peer as HB peer.Wladimir J. van der Laan
dd5b011 [Trivial] add comment about setting peer as HB peer. (John Newbery)
2017-02-06Merge #9227: Make nWalletDBUpdated atomic to avoid a potential race.Wladimir J. van der Laan
d63ff62 Make nWalletDBUpdated atomic to avoid a potential race. (Patrick Strateman)
2017-02-06Merge #9378: [trivial] Add documentation for CWalletTx::fFromMe member.Wladimir J. van der Laan
39c77b0 Add documentation for CWalletTx::fFromMe member. (Russell Yanofsky)
2017-02-06Merge #9650: Better handle invalid parameters to signrawtransactionWladimir J. van der Laan
6dbfe08 [qa] test signrawtransaction merge with missing inputs (Matt Corallo) ec4f7e4 [qa] Add second input to signrawtransaction test case (Matt Corallo) 691710a [qa] Test that decoderawtransaction throws with extra data appended (Matt Corallo) 922bea9 Better handle invalid parameters to signrawtransaction (Matt Corallo) 7ea0ad5 Fail in DecodeHexTx if there is extra data at the end (Matt Corallo)
2017-02-06Merge #9659: Net: Turn some methods and params/variables constWladimir J. van der Laan
0729102 Net: pass interruptMsgProc as const where possible (Jorge Timón) fc7f2ff Net: Make CNetMsgMaker more const (Jorge Timón) d45955f Net: CConnman: Make some methods const (Jorge Timón)
2017-02-06Merge #9651: Fix typosWladimir J. van der Laan
5f62e3e Fix typos (practicalswift)
2017-02-06Merge #9673: Set correct metadata on bumpfee wallet transactionsWladimir J. van der Laan
4ec057d [wallet] Set correct metadata on bumpfee wallet transactions (Russell Yanofsky)
2017-02-06Merge #9691: Init ECC context for test_bitcoin_fuzzy.Wladimir J. van der Laan
ac719c9 Init ECC context for test_bitcoin_fuzzy. (Gregory Maxwell)
2017-02-05Merge #9578: Add missing mempool lock for CalculateMemPoolAncestorsPieter Wuille
003cd60 Add missing mempool lock for CalculateMemPoolAncestors (Matt Corallo)
2017-02-05Init ECC context for test_bitcoin_fuzzy.Gregory Maxwell
This avoids calling things like pubkey_parse with a null context argument.
2017-02-04Merge #9671: Fix super-unlikely race introduced in 236618061a445d2cb11e72Wladimir J. van der Laan
885cfdd Fix super-unlikely race introduced in 236618061a445d2cb11e72 (Matt Corallo)
2017-02-04Merge #9609: net: fix remaining net assertionsWladimir J. van der Laan
08bb6f4 net: log an error rather than asserting if send version is misused (Cory Fields) 7a8c251 net: Disallow sending messages until the version handshake is complete (Cory Fields) 12752af net: don't run callbacks on nodes that haven't completed the version handshake (Cory Fields) 2046617 net: deserialize the entire version message locally (Cory Fields) 80ff034 Dont deserialize nVersion into CNode, should fix #9212 (Matt Corallo)
2017-02-03Access WorkQueue::running only within the cs lock.Matt Corallo
This removes a "race" between Interrupt() and Run(), though it should not effect any of our supported platforms.
2017-02-02[wallet] Set correct metadata on bumpfee wallet transactionsRussell Yanofsky
Preserve comment, order form, and account strings from the original wallet transaction. Also set fTimeReceivedIsTxTime and fFromMe fields for consistency with CWallet::CreateTransaction. The latter two fields don't influence current wallet behavior, but do record that the transaction originated in the wallet instead of coming from the network or sendrawtransaction.
2017-02-02Better handle invalid parameters to signrawtransactionMatt Corallo
This silently skips trying to merge signatures from inputs which do not exist from transactions provided to signrawtransaction, instead of hitting an assert.
2017-02-02Fail in DecodeHexTx if there is extra data at the endMatt Corallo
2017-02-02net: log an error rather than asserting if send version is misusedCory Fields
Also cleaned up the comments and moved from the header to the .cpp so that logging headers aren't needed from net.h
2017-02-02net: Disallow sending messages until the version handshake is completeCory Fields
This is a change in behavior, though it's much more sane now than before.
2017-02-02net: don't run callbacks on nodes that haven't completed the version handshakeCory Fields
Since ForEach* are can be used to send messages to all nodes, the caller may end up sending a message before the version handshake is complete. To limit this, filter out these nodes. While we're at it, may as well filter out disconnected nodes as well. Delete unused methods rather than updating them.
2017-02-02net: deserialize the entire version message locallyCory Fields
This avoids having some vars set if the version negotiation fails. Also copy it all into CNode at the same site. nVersion and fSuccessfullyConnected are set last, as they are the gates for the other vars. Make them atomic for that reason.
2017-02-02Dont deserialize nVersion into CNode, should fix #9212Matt Corallo
2017-02-02Fix super-unlikely race introduced in 236618061a445d2cb11e72Matt Corallo
Once the CNode has been added to vNodes, it is possible that it is disconnected+deleted in the socket handler thread. However, after that we now call InitializeNode, which accesses the pnode. helgrind managed to tickle this case (somehow), but I suspect it requires in immensely braindead scheduler.
2017-02-02Merge #9556: Remove redundant semicolonsWladimir J. van der Laan
8fc6989 Remove redundant semicolons (practicalswift)
2017-02-02Merge #9663: [RPC] clarify listunspent amount descriptionWladimir J. van der Laan
3eba88d clarify listunspent amount description (Gregory Sanders)
2017-02-01clarify listunspent amount descriptionGregory Sanders
2017-02-01Merge #9625: Increase minimum debug.log size to 10MB after shrink.Wladimir J. van der Laan
29fb311 Increase minimum debug.log size to 10MB after shrink. (Alex Morcos)
2017-01-31rpc: bumpfee: handle errors more gracefullySuhas Daftuar
2017-01-31rpc: bumpfee: use correct maximum signed tx size for fee calculationSuhas Daftuar
More accurate than simply adding one byte per input, and properly handles the case where the original transaction happened to have very small signatures
2017-01-31Net: pass interruptMsgProc as const where possibleJorge Timón
2017-01-31Net: Make CNetMsgMaker more constJorge Timón
2017-01-31Net: CConnman: Make some methods constJorge Timón
2017-01-30wallet: Refactor dummy signature signing for reusabilitySuhas Daftuar
2017-01-30Merge #9647: Skip RAII event tests if libevent is built without ↵Wladimir J. van der Laan
event_set_mem_functions 95f97f4 Skip RAII event tests if libevent is built without event_set_mem_functions (Luke Dashjr)
2017-01-30Merge #9649: [doc] Remove unused clang format dev scriptMarcoFalke
fa5137c [doc] Remove unused clang format dev script (MarcoFalke)
2017-01-30qt: periodic translations updateWladimir J. van der Laan
2017-01-30Merge #9644: [refactor] Remove using namespace <xxx> from src/MarcoFalke
b7b48c8 Refactor: Remove using namespace <xxx> from src/*.cpp. (Karl-Johan Alm)
2017-01-30Merge #9626: Clean up a few CConnman cs_vNodes/CNode thingsWladimir J. van der Laan
2366180 Do not add to vNodes until fOneShot/fFeeler/fAddNode have been set (Matt Corallo) 3c37dc4 Ensure cs_vNodes is held when using the return value from FindNode (Matt Corallo) 5be0190 Delete some unused (and broken) functions in CConnman (Matt Corallo)
2017-01-30Merge #9615: Wallet incremental feeWladimir J. van der Laan
4b189c1 Change bumpfee result value from 'oldfee' to 'origfee'. (Alex Morcos) 0c0c63f Introduce WALLET_INCREMENTAL_RELAY_FEE (Alex Morcos) e8021ec Use CWallet::GetMinimumFee in bumpfee (Alex Morcos) ae9719a Refactor GetMinimumFee to give option of providing targetFee (Alex Morcos) fe8e8ef [rpc] Add incremental relay fee to getnetworkinfo (Alex Morcos) 6b331e6 Fix to have miner test aware of new separate block min tx fee (Alex Morcos) de6400d Fix missing use of dustRelayFee (Alex Morcos) 5b15870 Use incrementalRelayFee for BIP 125 replacement (Alex Morcos)
2017-01-29Fix typospracticalswift
2017-01-28[doc] Remove unused clang format dev scriptMarcoFalke
Also, update the clang format file to reflect the current coding style mentioned in the developer notes.
2017-01-28Skip RAII event tests if libevent is built without event_set_mem_functionsLuke Dashjr
2017-01-27[trivial] Fix typos in commentspracticalswift
2017-01-27Refactor: Remove using namespace <xxx> from src/*.cpp.Karl-Johan Alm
2017-01-26Change bumpfee result value from 'oldfee' to 'origfee'.Alex Morcos
The result value indicates the actual fee on the transaction that was replaced. But there is an error message which uses the description 'oldfee' to refer to the original fee rate applied to the new transaction's estimated max size. It was confusing that two different uses of 'oldfee' had two different numeric values.
2017-01-26Introduce WALLET_INCREMENTAL_RELAY_FEEAlex Morcos
Have wallet's default bump value be higher than the default incrementalRelayFee to future proof against changes to incremental relay fee. Only applies when not setting the fee rate directly.