diff --git a/doc/release-notes.md b/doc/release-notes.md
index 5db8dfb03..83415ad49 100644
--- a/doc/release-notes.md
+++ b/doc/release-notes.md
@@ -1,70 +1,76 @@
Bitcoin ABC version 0.21.9 is now available from:
This release includes the following features and fixes:
- Improve management of maxfee by the wallet.
+- The `-enablebip61` command line option (introduced in Bitcoin ABC 0.19.11) is
+used to toggle sending of BIP 61 reject messages. Reject messages have no use
+case on the P2P network and are only logged for debugging by most network
+nodes. The option will now by default be off for improved privacy and security
+as well as reduced upload usage. The option can explicitly be turned on for
+local-network debugging purposes.
Wallet changes
--------------
When creating a transaction with a fee above `-maxtxfee` (default 0.1 BCH),
the RPC commands `walletcreatefundedpsbt` and `fundrawtransaction` will now fail
instead of rounding down the fee. Beware that the `feeRate` argument is specified
in BCH per kilobyte, not satoshi per byte.
Coin selection
--------------
### Reuse Avoidance
A new wallet flag `avoid_reuse` has been added (default off). When enabled,
a wallet will distinguish between used and unused addresses, and default to not
use the former in coin selection.
(Note: rescanning the blockchain is required, to correctly mark previously
used destinations.)
Together with "avoid partial spends" (present as of Bitcoin ABC v0.19.9), this
addresses a serious privacy issue where a malicious user can track spends by
peppering a previously paid to address with near-dust outputs, which would then
be inadvertently included in future payments.
New RPCs
--------
- `getbalances` returns an object with all balances (`mine`,
`untrusted_pending` and `immature`). Please refer to the RPC help of
`getbalances` for details. The new RPC is intended to replace
`getunconfirmedbalance` and the balance fields in `getwalletinfo`, as well as
`getbalance`. The old calls may be removed in a future version.
- A new `setwalletflag` RPC sets/unsets flags for an existing wallet.
RPC changes
-----------
The `getblockstats` RPC is faster for fee calculation by using BlockUndo data. Also, `-txindex` is no longer required and `getblockstats` works for all non-pruned blocks.
Several RPCs have been updated to include an "avoid_reuse" flag, used to control
whether already used addresses should be left out or included in the operation.
These include:
- createwallet
- getbalance
- sendtoaddress
In addition, `sendtoaddress` has been changed to enable `-avoidpartialspends` when
`avoid_reuse` is enabled.
The listunspent RPC has also been updated to now include a "reused" bool, for nodes
with "avoid_reuse" enabled.
Miscellaneous RPC changes
------------
- `createwallet` can now create encrypted wallets if a non-empty passphrase is specified.
diff --git a/src/net_processing.h b/src/net_processing.h
index b827fce7d..52f98108d 100644
--- a/src/net_processing.h
+++ b/src/net_processing.h
@@ -1,138 +1,138 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_NET_PROCESSING_H
#define BITCOIN_NET_PROCESSING_H
#include
#include
#include
#include
extern RecursiveMutex cs_main;
class Config;
/**
* Default for -maxorphantx, maximum number of orphan transactions kept in
* memory.
*/
static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100;
/**
* Default number of orphan+recently-replaced txn to keep around for block
* reconstruction.
*/
static const unsigned int DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN = 100;
/** Default for BIP61 (sending reject messages) */
-static constexpr bool DEFAULT_ENABLE_BIP61 = true;
+static constexpr bool DEFAULT_ENABLE_BIP61{false};
class PeerLogicValidation final : public CValidationInterface,
public NetEventsInterface {
private:
CConnman *const connman;
BanMan *const m_banman;
bool SendRejectsAndCheckIfBanned(CNode *pnode, bool enable_bip61)
EXCLUSIVE_LOCKS_REQUIRED(cs_main);
public:
PeerLogicValidation(CConnman *connman, BanMan *banman,
CScheduler &scheduler, bool enable_bip61);
/**
* Overridden from CValidationInterface.
*/
void
BlockConnected(const std::shared_ptr &pblock,
const CBlockIndex *pindexConnected,
const std::vector &vtxConflicted) override;
/**
* Overridden from CValidationInterface.
*/
void UpdatedBlockTip(const CBlockIndex *pindexNew,
const CBlockIndex *pindexFork,
bool fInitialDownload) override;
/**
* Overridden from CValidationInterface.
*/
void BlockChecked(const CBlock &block,
const CValidationState &state) override;
/**
* Overridden from CValidationInterface.
*/
void NewPoWValidBlock(const CBlockIndex *pindex,
const std::shared_ptr &pblock) override;
/**
* Initialize a peer by adding it to mapNodeState and pushing a message
* requesting its version.
*/
void InitializeNode(const Config &config, CNode *pnode) override;
/**
* Handle removal of a peer by updating various state and removing it from
* mapNodeState.
*/
void FinalizeNode(const Config &config, NodeId nodeid,
bool &fUpdateConnectionTime) override;
/**
* Process protocol messages received from a given node.
*/
bool ProcessMessages(const Config &config, CNode *pfrom,
std::atomic &interrupt) override;
/**
* Send queued protocol messages to be sent to a give node.
*
* @param[in] pto The node which we are sending messages to.
* @param[in] interrupt Interrupt condition for processing threads
* @return True if there is more work to be done
*/
bool SendMessages(const Config &config, CNode *pto,
std::atomic &interrupt) override
EXCLUSIVE_LOCKS_REQUIRED(pto->cs_sendProcessing);
/**
* Consider evicting an outbound peer based on the amount of time they've
* been behind our tip.
*/
void ConsiderEviction(CNode *pto, int64_t time_in_seconds)
EXCLUSIVE_LOCKS_REQUIRED(cs_main);
/**
* Evict extra outbound peers. If we think our tip may be stale, connect to
* an extra outbound.
*/
void
CheckForStaleTipAndEvictPeers(const Consensus::Params &consensusParams);
/**
* If we have extra outbound peers, try to disconnect the one with the
* oldest block announcement.
*/
void EvictExtraOutboundPeers(int64_t time_in_seconds)
EXCLUSIVE_LOCKS_REQUIRED(cs_main);
private:
//! Next time to check for stale tip
int64_t m_stale_tip_check_time;
/** Enable BIP61 (sending reject messages) */
const bool m_enable_bip61;
};
struct CNodeStateStats {
int nMisbehavior = 0;
int nSyncHeight = -1;
int nCommonHeight = -1;
std::vector vHeightInFlight;
};
/** Get statistics from node state */
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats);
/** Increase a node's misbehavior score. */
void Misbehaving(NodeId nodeid, int howmuch, const std::string &reason = "");
/** Relay transaction to every node */
void RelayTransaction(const TxId &txid, const CConnman &connman);
#endif // BITCOIN_NET_PROCESSING_H