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

Sync to upstream 0280fa0 #78

Merged
merged 30 commits into from
Mar 7, 2016
Merged

Sync to upstream 0280fa0 #78

merged 30 commits into from
Mar 7, 2016

Conversation

alexlyp
Copy link
Member

@alexlyp alexlyp commented Mar 3, 2016

No description provided.

dajohi and others added 27 commits June 24, 2015 20:34
Move lockTimeThreshold to txscript and export it.  This is a
consensus value which txscript will need in an upcoming diff.
When trickling inv's to peers, allocate for the number of inv's
in the queue instead of the default 1000.  This should save on
memory.
This change moves IsFinalizedTransaction to txscript and also changes
the first argument to take a wire.MsgTx instead of btcutil.Tx.  This
is needed for an upcoming diff in which txscript will require
IsFinalizedTransaction and we do not want to import the btcd/blockchain.
This reverts commit 17da2ba.

This was done prematurely.  This will be revisited when a code
restructure is more urgent.
This commit corrects the JSON-RPC API doc return to overview links for
the Websocket Extension Method Details section.
This commit correctly replaces persistent peers that are being retried in
the list of persistent peers so it will continue to be retried as
intended.

Also, limit the maximum retry interval for persistent peers to 5 minutes.

Fixes decred#463.
This mimics Bitcoin Core commit a1ba0778dd3c784046dea334e5d39f37eca264f7
This commit updates the wire tests for transactions which force
serialization and deserialization errors to force an error in the the
transaction lock time path.

This brings the wire test coverage back up to 100%.
At the current time, there is no difference between the wire encoding
at protocol version 0 and the stable long-term storage format.  These
methods are simply for consistency with the other types.
This mimics Bitcoin Core commit 076badb60f33f0c32b035de220ca14c52a423a2a
These copies were likely left over from when MsgTx had no deep copy
functionality.
This commit updates the merkle block handling to for the latest changes
to the btcutil API and optimizes it along the way.

Previously, the code was inefficiently reloading the transactions for
the matched hashes from the database instead of simply pulling them from
the full block that was used to create the merkle block.
This commit modifies the createTxRawResult code path along with callers
to work with block headers as opposed to btcutil.Blocks.  This in turn
allows the code in handleGetRawTransaction and
handleSearchRawTransactions to perform a much cheaper block header load
as opposed to a full block load.

While here, also very slightly optimize the createVinList function to
avoid creating a util.Tx wrapper and to take advantage of the
btcutil.Amount type added after the function was originally written
The comment says "only allow recent nodes (10mins) after we failed 30 times",
but the server actually did the opposite and allowed only recent nodes before
30 failed connection attempts. This corrects the server's behavior.
IsUnspendable takes a public key script and returns whether it is
spendable.

Additionally, hook this into the mempool isDust function, since
unspendable outputs can't be spent.

This mimics Bitcoin Core commit 0aad1f13b2430165062bf9436036c1222a8724da
This commit converts all block height references to int32 instead of
int64.  The current target block production rate is 10 mins per block
which means it will take roughly 40,800 years to reach the maximum
height an int32 affords.  Even if the target rate were lowered to one
block per minute, it would still take roughly another 4,080 years to
reach the maximum.

In the mean time, there is no reason to use a larger type which results
in higher memory and disk space usage.  However, for now, in order to
avoid having to reserialize a bunch of database information, the heights
are still serialized to the database as 8-byte uint64s.

This is being mainly being done in preparation for further upcoming
infrastructure changes which will use the smaller and more efficient
4-byte serialization in the database as well.
@jcvernaleo
Copy link
Member

Unfortunately, I think this needs a rebase (or whatever the sync equivalent is).

Conflicts:
	blockchain/chain.go
	blockchain/checkpoints.go
	blockchain/difficulty.go
	blockchain/internal_test.go
	blockchain/txlookup.go
	blockchain/validate.go
	blockchain/validate_test.go
	blockmanager.go
	chaincfg/params.go
	cmd/dropafter/dropafter.go
	cpuminer.go
	database/db.go
	database/interface_test.go
	database/ldb/block.go
	database/ldb/insertremove_test.go
	database/ldb/leveldb.go
	database/ldb/operational_test.go
	database/ldb/tx.go
	database/memdb/memdb.go
	database/reorg_test.go
	dcrjson/walletsvrcmds.go
	docs/README.md
	docs/json_rpc_api.md
	mempool.go
	mining.go
	peer.go
	rpcserver.go
	rpcserverhelp.go
	rpcwebsocket.go
	sample-dcrd.conf
	txscript/consensus.go
	txscript/script_test.go
	txscript/sign.go
	txscript/standard.go
	wire/blockheader_test.go
	wire/msgtx_test.go
@jcvernaleo
Copy link
Member

tACK

I checked the history, looked at code, tested on simnet, testnet, and did a full chaindownload on mainnet.

@cjepson
Copy link
Contributor

cjepson commented Mar 7, 2016

utACK. Most of the changes are minimal affecting comments or syntax. Looks OK.

@jcvernaleo jcvernaleo merged commit cb95669 into decred:master Mar 7, 2016
@alexlyp alexlyp deleted the new_sync branch May 17, 2016 17:57
davecgh added a commit that referenced this pull request Oct 12, 2017
This updates all code in the main package and subpackages to make use of
the new chainhash package since the old wire.ShaHash type and functions
have been removed in favor of the abstracted package.

Also, since this required API changes anyways and the hash algorithm is
no longer tied specifically to SHA, all other functions throughout the
code base which had "Sha" in their name have been changed to Hash so
they are not incorrectly implying the hash algorithm.

The following is an overview of the changes:

- Update all references to wire.ShaHash to the new chainhash.Hash type
- Rename the following functions and update all references:
  - Block.Sha -> Hash
  - Block.TxSha -> TxHash
  - Tx.Sha -> Hash
  - bloom.Filter.AddShaHash -> AddHash
- Rename all variables that included sha in their name to include hash
  instead
- Add license headers to coinset package files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants