profile
viewpoint

amitiuttarwar/bitcoin-notes 3

la la la bitcoin

f3nry/ethereum-playground 1

Testing the waters of ethereum and solidity

jnewbery/bitcoin 1

Bitcoin Core integration/staging tree

amitiuttarwar/bitcoin 0

Bitcoin Core integration/staging tree

amitiuttarwar/bitcoin-core-review-club.github.io 0

Bitcoin Core PR Review club website

amitiuttarwar/bitcoin-curriculum 0

Bitcoin Protocol Development Curriculum

amitiuttarwar/qa-assets 0

Bitcoin Core related blobs used for quality assurance

PR opened bitcoin/bitcoin

doc: fix broken link to whitepaper in README

Earlier today the Bitcoin whitepaper has been removed from the bitcoincore.org website. A decision I strongly disagree with but nevertheless fully respect and understand.

I hope the Core maintainers would reconsider this decision, but in case it is final, this PR fixes the link which the README.md has to the whitepaper by targeting the bitcoin.org website instead of the bitcoincore.org, where the page no longer exists.

+1 -1

0 comment

1 changed file

pr created time in 9 minutes

issue commentbitcoin/bitcoin

Small memory leak when BerkeleyEnvironment::Open fails

Opened #20974 to test this. Leak does still happen https://cirrus-ci.com/task/5428735379767296?command=ci#L4680

==36296==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 65840 byte(s) in 2 object(s) allocated from:
    #0 0x55fe2c45d3bd in malloc (/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/bitcoind+0x17733bd)
    #1 0x7f03e35788c4 in __os_malloc (/lib/x86_64-linux-gnu/libdb_cxx-5.3.so+0x1698c4)
SUMMARY: AddressSanitizer: 65840 byte(s) leaked in 2 allocation(s). 
ryanofsky

comment created time in 14 minutes

issue commentbitcoin/bitcoin

Can I make readme.md and other introduction files in another language?

I'd like to help.

This sounds like a good idea. If this is to be done it should be done as a coordinated effort to include translations in other languages as well. One issue will be maintainability as documentation changes. I suppose one thing to ease that could be to include the docs on Transifex.

So what's the plan? How about adding README.xx.md besides README.md and doc_xx besides doc, with the help of Transifex?

programmer1017

comment created time in 28 minutes

pull request commentbitcoin/bitcoin

locks: Annotate CTxMemPool::check to require cs_main

Happy to re-ACK if you add documentation or update the commit message with the info in #20972 (comment).

I wasn't really suggesting that we add documentation, just that we don't add misleading documentation that cs_main is only needed for GetSpendHeight. I can see the benefit to documenting the reasoning in the commit log, and would be happy to reACK a push that adds that commit message.

I'd prefer to add the lock annotations (to GetSpendHeight and maybe others), so that the code is self-documenting.

I'll commit to reviewing this (here or in a follow-up PR).

dongcarl

comment created time in 29 minutes

Pull request review commentbitcoin/bitcoin

zmq: deduplicate 'sequence' publisher message creation/sending

 bool CZMQPublishRawTransactionNotifier::NotifyTransaction(const CTransaction &tr     return SendZmqMessage(MSG_RAWTX, &(*ss.begin()), ss.size()); } +// Helper function to send a 'sequence' topic message  with the following structure:+//    <32-byte hash> | <1-byte label> | <8-byte LE sequence> (optional)+static bool SendSequenceMsg(CZMQAbstractPublishNotifier& notifier, uint256 hash, char label, std::optional<uint64_t> sequence = {})+{+    unsigned char data[sizeof(hash)+sizeof(label)+sizeof(uint64_t)];

Done.

theStack

comment created time in 35 minutes

Pull request review commentbitcoin/bitcoin

zmq: deduplicate 'sequence' publisher message creation/sending

 bool CZMQPublishRawTransactionNotifier::NotifyTransaction(const CTransaction &tr     return SendZmqMessage(MSG_RAWTX, &(*ss.begin()), ss.size()); } +// Helper function to send a 'sequence' topic message  with the following structure:+//    <32-byte hash> | <1-byte label> | <8-byte LE sequence> (optional)+static bool SendSequenceMsg(CZMQAbstractPublishNotifier& notifier, uint256 hash, char label, std::optional<uint64_t> sequence = {})+{+    unsigned char data[sizeof(hash)+sizeof(label)+sizeof(uint64_t)];+    for (unsigned int i = 0; i < sizeof(hash); ++i) {+        data[sizeof(hash) - 1 - i] = hash.begin()[i];+    }+    data[sizeof(hash)] = label;+    if (sequence) WriteLE64(data+sizeof(hash)+sizeof(label), *sequence);+    return notifier.SendZmqMessage(MSG_SEQUENCE, data, sequence ? sizeof(data) : sizeof(hash)+sizeof(label));

Done.

theStack

comment created time in 35 minutes

pull request commentbitcoin/bitcoin

zmq: deduplicate 'sequence' publisher message creation/sending

Thanks for your reviews! Force-pushed with the suggestions of @jonatack.

theStack

comment created time in 35 minutes

Pull request review commentbitcoin/bitcoin

zmq: deduplicate 'sequence' publisher message creation/sending

 bool CZMQPublishRawTransactionNotifier::NotifyTransaction(const CTransaction &tr     return SendZmqMessage(MSG_RAWTX, &(*ss.begin()), ss.size()); } +// Helper function to send a 'sequence' topic message  with the following structure:

Good eye! :) Done.

theStack

comment created time in 35 minutes

Pull request review commentbitcoin/bitcoin

util: Add ArgsManager::GetCommand() and use it in bitcoin-wallet

 int main(int argc, char* argv[])         return EXIT_FAILURE;     } -    std::string method {};-    for(int i = 1; i < argc; ++i) {-        if (!IsSwitchChar(argv[i][0])) {-            if (!method.empty()) {-                tfm::format(std::cerr, "Error: two methods provided (%s and %s). Only one method should be provided.\n", method, argv[i]);-                return EXIT_FAILURE;-            }-            method = argv[i];-        }-    }--    if (method.empty()) {+    std::string method;+    std::vector<std::string> cmdargs;+    if (!args.GetCommand(method, cmdargs)) {         tfm::format(std::cerr, "No method provided. Run `bitcoin-wallet -help` for valid methods.\n");

Seems unrelated, so I am going to leave as is for now to minimize the diff

MarcoFalke

comment created time in an hour

Pull request review commentbitcoin/bitcoin

util: Add ArgsManager::GetCommand() and use it in bitcoin-wallet

 int main(int argc, char* argv[])         return EXIT_FAILURE;     } -    std::string method {};-    for(int i = 1; i < argc; ++i) {-        if (!IsSwitchChar(argv[i][0])) {-            if (!method.empty()) {-                tfm::format(std::cerr, "Error: two methods provided (%s and %s). Only one method should be provided.\n", method, argv[i]);-                return EXIT_FAILURE;-            }-            method = argv[i];-        }-    }--    if (method.empty()) {+    std::string method;

Thanks, fixed

MarcoFalke

comment created time in an hour

Pull request review commentbitcoin/bitcoin

util: Add ArgsManager::GetCommand() and use it in bitcoin-wallet

 int main(int argc, char* argv[])         return EXIT_FAILURE;     } -    std::string method {};-    for(int i = 1; i < argc; ++i) {-        if (!IsSwitchChar(argv[i][0])) {-            if (!method.empty()) {-                tfm::format(std::cerr, "Error: two methods provided (%s and %s). Only one method should be provided.\n", method, argv[i]);-                return EXIT_FAILURE;-            }-            method = argv[i];-        }-    }--    if (method.empty()) {+    std::string method;+    std::vector<std::string> cmdargs;+    if (!args.GetCommand(method, cmdargs)) {         tfm::format(std::cerr, "No method provided. Run `bitcoin-wallet -help` for valid methods.\n");         return EXIT_FAILURE;     }+    if (cmdargs.size() != 0) {+        tfm::format(std::cerr, "Error: Additional arguments provided (%s). Please refer to `-help`. Commands do not take arguments.\n", Join(cmdargs, ", "));

Thanks, fixed

MarcoFalke

comment created time in an hour

Pull request review commentbitcoin/bitcoin

util: Add ArgsManager::GetCommand() and use it in bitcoin-wallet

 int main(int argc, char* argv[])         return EXIT_FAILURE;     } -    std::string method {};-    for(int i = 1; i < argc; ++i) {-        if (!IsSwitchChar(argv[i][0])) {-            if (!method.empty()) {-                tfm::format(std::cerr, "Error: two methods provided (%s and %s). Only one method should be provided.\n", method, argv[i]);-                return EXIT_FAILURE;-            }-            method = argv[i];-        }-    }--    if (method.empty()) {+    std::string method;+    std::vector<std::string> cmdargs;+    if (!args.GetCommand(method, cmdargs)) {

Thanks. Fixed, I think

MarcoFalke

comment created time in an hour

Pull request review commentbitcoin/bitcoin

util: Add ArgsManager::GetCommand() and use it in bitcoin-wallet

 Optional<unsigned int> ArgsManager::GetArgFlags(const std::string& name) const     return nullopt; } +bool ArgsManager::GetCommand(std::string& cmd, std::vector<std::string>& args) const+{+    LOCK(cs_args);+    assert(!m_accept_any_command); // AddCmd must have been called before this

Thanks. Fixed, I think

MarcoFalke

comment created time in an hour

Pull request review commentbitcoin/bitcoin

util: Add ArgsManager::GetCommand() and use it in bitcoin-wallet

 Optional<unsigned int> ArgsManager::GetArgFlags(const std::string& name) const     return nullopt; } +bool ArgsManager::GetCommand(std::string& cmd, std::vector<std::string>& args) const

I took the naming from https://github.com/ajtowns/bitcoin/commit/ff48eb93bd485fb5e722d47690508f2a3506d30c. Nonetheless, changed in the latest force push.

MarcoFalke

comment created time in an hour

Pull request review commentbitcoin/bitcoin

zmq: deduplicate 'sequence' publisher message creation/sending

 bool CZMQPublishRawTransactionNotifier::NotifyTransaction(const CTransaction &tr     return SendZmqMessage(MSG_RAWTX, &(*ss.begin()), ss.size()); } +// Helper function to send a 'sequence' topic message  with the following structure:+//    <32-byte hash> | <1-byte label> | <8-byte LE sequence> (optional)+static bool SendSequenceMsg(CZMQAbstractPublishNotifier& notifier, uint256 hash, char label, std::optional<uint64_t> sequence = {})+{+    unsigned char data[sizeof(hash)+sizeof(label)+sizeof(uint64_t)];+    for (unsigned int i = 0; i < sizeof(hash); ++i) {+        data[sizeof(hash) - 1 - i] = hash.begin()[i];+    }+    data[sizeof(hash)] = label;+    if (sequence) WriteLE64(data+sizeof(hash)+sizeof(label), *sequence);+    return notifier.SendZmqMessage(MSG_SEQUENCE, data, sequence ? sizeof(data) : sizeof(hash)+sizeof(label));

nit, clang format

-    if (sequence) WriteLE64(data+sizeof(hash)+sizeof(label), *sequence);
-    return notifier.SendZmqMessage(MSG_SEQUENCE, data, sequence ? sizeof(data) : sizeof(hash)+sizeof(label));
+    if (sequence) WriteLE64(data + sizeof(hash) + sizeof(label), *sequence);
+    return notifier.SendZmqMessage(MSG_SEQUENCE, data, sequence ? sizeof(data) : sizeof(hash) + sizeof(label));
theStack

comment created time in 2 hours

Pull request review commentbitcoin/bitcoin

zmq: deduplicate 'sequence' publisher message creation/sending

 bool CZMQPublishRawTransactionNotifier::NotifyTransaction(const CTransaction &tr     return SendZmqMessage(MSG_RAWTX, &(*ss.begin()), ss.size()); } +// Helper function to send a 'sequence' topic message  with the following structure:+//    <32-byte hash> | <1-byte label> | <8-byte LE sequence> (optional)+static bool SendSequenceMsg(CZMQAbstractPublishNotifier& notifier, uint256 hash, char label, std::optional<uint64_t> sequence = {})

notifier can be passed as reference to const rather than reference

static bool SendSequenceMsg(const CZMQAbstractPublishNotifier& notifier, uint256 hash, char label, std::optional<uint64_t> sequence = {})
theStack

comment created time in 2 hours

Pull request review commentbitcoin/bitcoin

zmq: deduplicate 'sequence' publisher message creation/sending

 bool CZMQPublishRawTransactionNotifier::NotifyTransaction(const CTransaction &tr     return SendZmqMessage(MSG_RAWTX, &(*ss.begin()), ss.size()); } +// Helper function to send a 'sequence' topic message  with the following structure:+//    <32-byte hash> | <1-byte label> | <8-byte LE sequence> (optional)+static bool SendSequenceMsg(CZMQAbstractPublishNotifier& notifier, uint256 hash, char label, std::optional<uint64_t> sequence = {})+{+    unsigned char data[sizeof(hash)+sizeof(label)+sizeof(uint64_t)];

nit, clang format

    unsigned char data[sizeof(hash) + sizeof(label) + sizeof(uint64_t)];
theStack

comment created time in 2 hours

Pull request review commentbitcoin/bitcoin

zmq: deduplicate 'sequence' publisher message creation/sending

 bool CZMQPublishRawTransactionNotifier::NotifyTransaction(const CTransaction &tr     return SendZmqMessage(MSG_RAWTX, &(*ss.begin()), ss.size()); } +// Helper function to send a 'sequence' topic message  with the following structure:

nit extra space

// Helper function to send a 'sequence' topic message with the following structure:
theStack

comment created time in 2 hours

pull request commentbitcoin/bitcoin

locks: Annotate CTxMemPool::check to require cs_main

if you add documentation

If this is changed, I'd prefer to add the lock annotations (to GetSpendHeight and maybe others), so that the code is self-documenting. As in: Accidentally removing a lock(annotation) will fail to compile with a verbose reason.

dongcarl

comment created time in 2 hours

pull request commentbitcoin/bitcoin

Implement Bech32m and use it for v1+ segwit addresses

utACK https://github.com/bitcoin/bitcoin/pull/20861/commits/2827cf86559a9310ca3fb8b19e03422586a21a2b

sipa

comment created time in 3 hours

pull request commentbitcoin/bitcoin

doc: Add tracing.md, documenting eBPF tracing

I think we should probably get a concept ACK from other contributors on whether we should start adding tracepoints all over the code. I can see the benefit that they're very powerful and add almost no overhead when not used. On the other hand, there's almost an unlimited number of things that could be traced, adding TRACE() macros in lots of places could potentially make the source less readable, and it's possible to do a lot of useful tracing with uprobes that don't require any changes to the source.

Do we know what other projects are doing? Is it common to put lots of USDTs into the master branch? Perhaps we should discuss what our approach should be in a core dev meeting.

laanwj

comment created time in 3 hours

pull request commentbitcoin/bitcoin

doc: APS explanation clarified in 0.21.0 release notes

I prefer the current description that describes the default and agree with s/a difference/an increase/.

dscotese

comment created time in 3 hours

Pull request review commentbitcoin/bitcoin

locks: Annotate CTxMemPool::check to require cs_main

 void CTxMemPool::check(const CCoinsViewCache *pcoins) const      if (GetRand(m_check_ratio) >= 1) return; +    AssertLockHeld(::cs_main);

Could mention for which function this is needed?

I've dug into this function a bit more, and I think it's more than that. check() takes a copy of the CoinsTip:

https://github.com/bitcoin/bitcoin/blob/3734adba390cef881445c4de780e2a3bb080c512/src/txmempool.cpp#L627

and is then fetching coins from that CCoinsViewCache via CheckTxInputs():

https://github.com/bitcoin/bitcoin/blob/3734adba390cef881445c4de780e2a3bb080c512/src/txmempool.cpp#L610

If the coins in that CCoinsView were to be updated by a different thread while check() is running, then we could hit an assert. There's an implicit assumption that the CCoinsView won't change while this function is running, so I think we need cs_main throughout this function.

It's a shame that mempool calls back into validation in this way and has a circular dependency, but that's how it is for now.

dongcarl

comment created time in 4 hours

pull request commentbitcoin/bitcoin

zmq: deduplicate 'sequence' publisher message creation/sending

review ACK f231ffde04cbd20ba3ec3dc897f6484783ed9e76

theStack

comment created time in 4 hours

Pull request review commentbitcoin/bitcoin

locks: Annotate CTxMemPool::check to require cs_main

 void CTxMemPool::check(const CCoinsViewCache *pcoins) const      if (GetRand(m_check_ratio) >= 1) return; +    AssertLockHeld(::cs_main);
    AssertLockHeld(::cs_main); // for GetSpendHeight

nit: Could mention for which function this is needed?

nit: Since all callers of GetSpendHeight already have cs_main, would it make sense to remove the recursive lock from GetSpendHeight itself and replace it with a debug-only/compile-only AssertLockHeld/EXCLUSIVE_LOCKS_REQUIRED?

dongcarl

comment created time in 4 hours

pull request commentbitcoin/bitcoin

rpc: Add specific error code for "wallet already loaded"

Concept ACK

laanwj

comment created time in 4 hours

pull request commentbitcoin/bitcoin

test: Work around libFuzzer deadlock

cr ACK fa39c8a3e8f1090103468780d122a4cf4191bc13: patch looks correct

MarcoFalke

comment created time in 5 hours

pull request commentbitcoin/bitcoin

wallet, rpc: add listdescriptors command

Added functional test

S3RK

comment created time in 5 hours

pull request commentbitcoin/bitcoin

locks: Annotate CTxMemPool::check to require cs_main

Code review ACK b3964670537d0943b8fb2d8f2ea419cbefd4835a

Verified that the three call sites (two in net_processing.cpp and one in validation.cpp) all hold cs_main before calling mempool.check().

dongcarl

comment created time in 5 hours

Pull request review commentbitcoin/bitcoin

fuzz: Consolidate fuzzing TestingSetup initialization

 bool operator==(const Coin& a, const Coin& b)  void initialize_coins_view() {-    static const ECCVerifyHandle ecc_verify_handle;-    ECC_Start();-    SelectParams(CBaseChainParams::REGTEST);+    static const auto testing_setup = MakeFuzzingContext<const TestingSetup>();

Thanks, makes sense.

dongcarl

comment created time in 5 hours

more