diff options
| author | Pieter Wuille <[email protected]> | 2014-07-06 14:47:23 +0200 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2014-07-06 14:47:23 +0200 |
| commit | 40f5cb878edd04b4be14f0d73ab706dc2e69124c (patch) | |
| tree | aae507c6c1d36578d7a80c00df08e1780a7e5dcb /src/main.cpp | |
| parent | Merge pull request #4421 (diff) | |
| download | discoin-40f5cb878edd04b4be14f0d73ab706dc2e69124c.tar.xz discoin-40f5cb878edd04b4be14f0d73ab706dc2e69124c.zip | |
Send rejects and apply DoS scoring for errors in direct block validation.
75f51f2a introduced asynchronous processing for blocks, where reject messages
and DoS scoring could be applied outside of ProcessBlock, because block
validation may happen later.
However, some types of errors are still detected immediately (in particular,
CheckBlock violations), which need acting after ProcessBlock returns.
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index b2773953d..04af88ba4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3984,6 +3984,16 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) CValidationState state; ProcessBlock(state, pfrom, &block); + int nDoS; + if (state.IsInvalid(nDoS)) { + pfrom->PushMessage("reject", strCommand, state.GetRejectCode(), + state.GetRejectReason(), inv.hash); + if (nDoS > 0) { + LOCK(cs_main); + Misbehaving(pfrom->GetId(), nDoS); + } + } + } |