Skip to content

Conversation

instagibbs
Copy link
Member

For clarity of return values of size estimation functions.

Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 79e2a27

Good idea; the code is much clearer with the struct. It might be nice to clang-format the touched function signatures.

Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 79e2a27

@achow101
Copy link
Member

ACK 79e2a27

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 79e2a27. I was going to suggest returning std::optional<TxSize> instead of TxSize to get rid of magic return TxSize{-1, -1}; negative sizes, but this would be a bigger change and -1 seems to be used outside of this anyway.

@practicalswift
Copy link
Contributor

Concept ACK

Non-blocking suggestion: Could in-class initialize vsize and weight to reasonable defaults?

@DrahtBot
Copy link
Contributor

DrahtBot commented May 24, 2021

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some nits and pointed out that doxygen will be messed up

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@@ -1628,14 +1628,14 @@ bool CWallet::ImportScriptPubKeys(const std::string& label, const std::set<CScri
}

// Returns pair of vsize and weight
std::pair<int64_t, int64_t> CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, bool use_max_sig)
TxSize CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, bool use_max_sig)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format

@@ -1644,16 +1644,16 @@ std::pair<int64_t, int64_t> CalculateMaximumSignedTxSize(const CTransaction &tx,
}

// txouts needs to be in the order of tx.vin
std::pair<int64_t, int64_t> CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, const std::vector<CTxOut>& txouts, bool use_max_sig)
TxSize CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, const std::vector<CTxOut>& txouts, bool use_max_sig)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@jonatack
Copy link
Member

utACK 299e85c

good changes in git diff 79e2a27 299e85c, modulo clang format nits

@instagibbs
Copy link
Member Author

rebased on master

@maflcko
Copy link
Member

maflcko commented May 26, 2021

review ACK 881a3e2

@practicalswift
Copy link
Contributor

cr ACK 881a3e2

Much more readable!

Possible candidates for similar treatment (out of scope for this PR of course):

$ git grep -E '^( |std::optional<)*std::pair.*\(' -- "*.h"
src/consensus/tx_verify.h:std::pair<int, int64_t> CalculateSequenceLocks(const CTransaction &tx, int flags, std::vector<int>& prevHeights, const CBlockIndex& block);
src/httpserver.h:    std::pair<bool, std::string> GetHeader(const std::string& hdr) const;
src/indirectmap.h:    std::pair<iterator, bool> insert(const value_type& value) { return m.insert(value); }
src/pubkey.h:    std::optional<std::pair<XOnlyPubKey, bool>> CreateTapTweak(const uint256* merkle_root) const;
src/rpc/util.h:std::pair<int64_t, int64_t> ParseDescriptorRange(const UniValue& value);
src/txorphanage.h:    std::pair<CTransactionRef, NodeId> GetTx(const uint256& txid) const EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
src/util/readwritefile.h:std::pair<bool,std::string> ReadBinaryFile(const fs::path &filename, size_t maxsize=std::numeric_limits<size_t>::max());
src/util/system.h:    std::pair<int, char**> get();

@fanquake fanquake merged commit 7aa41fc into bitcoin:master May 26, 2021
Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 881a3e2.

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 27, 2021
gwillen pushed a commit to ElementsProject/elements that referenced this pull request Jun 1, 2022
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants