Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CBufferedFile and use it for -loadblock and bootstrap.dat #1962

Merged
merged 2 commits into from
Nov 9, 2012

Conversation

sipa
Copy link
Member

@sipa sipa commented Oct 27, 2012

The first commit adds CBufferedFile, which works like CAutoFile, but buffers the data in memory, so it is rewindable, and supports fast scanning inside the buffer.

The second commits switches LoadExternalBlocksFromFile to use CBufferedFile, simplifying it, and removing all fseek()'s.

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/f7bb8d71edbe2168622040ed8f13867e44f57cb5 for binaries and test log.

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/0e53edbd61b9020b338a9fd7cae24fb5ed575d02 for binaries and test log.

@laanwj
Copy link
Member

laanwj commented Nov 5, 2012

ACK
Op 1 nov. 2012 20:38 schreef "BitcoinPullTester" notifications@github.com
het volgende:

Automatic sanity-testing: PASSED, see
http://jenkins.bluematt.me/pull-tester/0e53edbd61b9020b338a9fd7cae24fb5ed575d02for binaries and test log.


Reply to this email directly or view it on GitHubhttps://github.com//pull/1962#issuecomment-9992887.

@sipa sipa merged commit 05d9726 into bitcoin:master Nov 9, 2012
HashUnlimited pushed a commit to chaincoin/chaincoin that referenced this pull request Apr 6, 2018
bitcoin#1962 changes the minimum required confirmations for InstantSend to 2 when
running in testnet. This resulted in the quorum rank calculation to pick
blocks which are higher then the current chain tip. This commit fixes this
by calculating the added height based on nInstantSendConfirmationsRequired.

This results in the value 4 for mainnet, so no incompatibility is
introduced. On testnet and regtest, this results in 0.
KolbyML pushed a commit to KolbyML/bitcoin that referenced this pull request Dec 5, 2020
056cf79 [Wallet] Remove spent coins from the availableCoins cache for staking (random-zebra)
f938a0b [Wallet] Check if coin is spent before trying to stake with it (random-zebra)
2b1a57a [Miner] Check for stakeable coins at every block (random-zebra)

Pull request description:

  Currently, during the staking thread, the list of available coins is updated every 5 minutes.
  This can lead to two problems:
  - If a coin is not included due to low confirmations number, when it matures, it cannot be staked immediately: it gets included only after the full 5 minutes.
  - If a coin is spent, it is not removed immediately from the list. So, if a valid kernel is found with said coin, the following two things happen.
  First, the newly created block fails `TestBlockValidity` (as it contains essentially a double spend) and gets discarded by the staker, who also clears his mempool (thus removing the transaction that was spending the coin).
  Then, after few seconds, the staker tries again with the same coin, finding again a valid kernel with it, but this time creating a (valid) empty block. The wallet transaction, originally spending the stake input, and later removed from the memory pool, is now marked conflicted.

  For now, let's address the issue by:
  - reloading the list of available coins whenever the tip hash changes (so, at least, at every block).
  - checking for in-wallet spent-status before staking (as the list of coins is updated only when a new block arrives, a certain coin could have been spent in the mempool afterwards).

  Closes bitcoin#1923

  A better approach (future work), would be to implement an interface in the miner, subscribing to the wallet signals and updating the stakeable coins cache only when a coin is added, or is spent (or matures).

ACKs for top commit:
  furszy:
    nice fix man, ACK 056cf79.
  Fuzzbawls:
    utACK 056cf79

Tree-SHA512: 83e481d5801ef3c5b3cb9a195770c333a2236ec6eae89474020c6768c53b48d2132d8a641f299259c8f8e4ec346fbcad9f5646d952a1f19784aa0991db50fa97
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants