aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-04-04 13:08:22 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-04-04 13:08:29 +0200
commit834aaef7bd37694b5cf231df1081563cc80916a3 (patch)
tree38505e87fdf2d58f98b34be754ec33c7fb9dbd59 /src/main.h
parentc5f94f6584cb7e9119ca55ae57736682ce0a6225 (diff)
parent640666b22fdbc6f436fbf701629b04a2367f7317 (diff)
downloadbitcoin-834aaef7bd37694b5cf231df1081563cc80916a3.tar.xz
Merge #7543: [0.12] Backport BIP9, BIP68 and BIP112 with softfork
640666b [qa] rpc-tests: Properly use integers, floats (BtcDrak) c270b62 Fix comments in tests (BtcDrak) caf1381 Add bip68-sequence.py to extended rpc tests (BtcDrak) 26e9a05 Test of BIP9 fork activation of mtp, csv, sequence_lock (NicolasDorier) 3a99feb Add RPC test for BIP 68/112/113 soft fork. (Alex Morcos) 159ee3d Policy: allow transaction version 2 relay policy. (BtcDrak) 9713ed3 Soft fork logic for BIP68 (BtcDrak) 648be9b Soft fork logic for BIP113 (BtcDrak) ee40924 Add CHECKSEQUENCEVERIFY softfork through BIP9 (Pieter Wuille) 6ff0b9f RPC test for BIP9 warning logic (Suhas Daftuar) 0710b30 Test versionbits deployments (Suhas Daftuar) 8ebc6f2 Add testing of ComputeBlockVersion (Suhas Daftuar) 0bdaacd Softfork status report in RPC (Pieter Wuille) 5f90d4e Versionbits tests (Pieter Wuille) 6f83cf2 BIP9 Implementation (Pieter Wuille) ade85e1 Add LockPoints (Alex Morcos) c8d309e Code style fix. (BtcDrak) 6170506 Separate CheckLockTime() and CheckSequence() logic (BtcDrak) c0c5e09 BIP112: Implement CHECKSEQUENCEVERIFY (Mark Friedenbach) 197c376 fix sdaftuar's nits again (Alex Morcos) 0a79c04 Bug fix to RPC test (Alex Morcos) 0d09af7 Add RPC test exercising BIP68 (mempool only) (Suhas Daftuar) 15ba08c Implement SequenceLocks functions (Alex Morcos)
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/main.h b/src/main.h
index c63e190706..47e18eab4d 100644
--- a/src/main.h
+++ b/src/main.h
@@ -16,6 +16,7 @@
#include "net.h"
#include "script/script_error.h"
#include "sync.h"
+#include "versionbits.h"
#include <algorithm>
#include <exception>
@@ -39,6 +40,7 @@ class CValidationInterface;
class CValidationState;
struct CNodeStateStats;
+struct LockPoints;
/** Default for accepting alerts from the P2P network. */
static const bool DEFAULT_ALERTS = false;
@@ -274,6 +276,9 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
/** Convert CValidationState to a human-readable message for logging */
std::string FormatStateMessage(const CValidationState &state);
+/** Get the BIP9 state for a given deployment at the current tip. */
+ThresholdState VersionBitsTipState(const Consensus::Params& params, Consensus::DeploymentPos pos);
+
struct CNodeStateStats {
int nMisbehavior;
int nSyncHeight;
@@ -353,7 +358,31 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime);
*/
bool CheckFinalTx(const CTransaction &tx, int flags = -1);
-/**
+/**
+ * Test whether the LockPoints height and time are still valid on the current chain
+ */
+bool TestLockPointValidity(const LockPoints* lp);
+
+/**
+ * Check if transaction is final per BIP 68 sequence numbers and can be included in a block.
+ * Consensus critical. Takes as input a list of heights at which tx's inputs (in order) confirmed.
+ */
+bool SequenceLocks(const CTransaction &tx, int flags, std::vector<int>* prevHeights, const CBlockIndex& block);
+
+/**
+ * Check if transaction will be BIP 68 final in the next block to be created.
+ *
+ * Simulates calling SequenceLocks() with data from the tip of the current active chain.
+ * Optionally stores in LockPoints the resulting height and time calculated and the hash
+ * of the block needed for calculation or skips the calculation and uses the LockPoints
+ * passed in for evaluation.
+ * The LockPoints should not be considered valid if CheckSequenceLocks returns false.
+ *
+ * See consensus/consensus.h for flag definitions.
+ */
+bool CheckSequenceLocks(const CTransaction &tx, int flags, LockPoints* lp = NULL, bool useExistingLockPoints = false);
+
+/**
* Closure representing one script verification
* Note that this stores references to the spending transaction
*/
@@ -503,6 +532,11 @@ extern CBlockTreeDB *pblocktree;
*/
int GetSpendHeight(const CCoinsViewCache& inputs);
+/**
+ * Determine what nVersion a new block should use.
+ */
+int32_t ComputeBlockVersion(const CBlockIndex* pindexPrev, const Consensus::Params& params);
+
/** Reject codes greater or equal to this can be returned by AcceptToMemPool
* for transactions, to signal internal conditions. They cannot and should not
* be sent over the P2P network.