Commit graph

26 commits

Author SHA1 Message Date
Roy Lee
c0f98b1f8e [lbry] ci: fix linting errors 2021-09-14 13:27:52 -07:00
Brannon King
e72f99ac3f renamed package to lbcutil, updated refs to it 2021-09-10 16:37:45 -04:00
Anirudha Bose
c53e27f6f1 Fix OutOfRangeError checks in block_test.go 2020-07-13 09:48:38 -04:00
Anirudha Bose
29af078e7b
Fix nil pointer dereference when WitnessHash is called before HasWitness
Issue: btcsuite/btcd#1543
Related PR: btcsuite/btcutil#156
2020-05-05 09:28:57 +05:30
Dave Collins
22c91fa80a Update for recent chainhash-related API changes. (#78)
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
2016-08-08 12:38:16 -05:00
Dave Collins
1c7f05922f Convert block heights to int32.
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 usage.
2015-08-07 22:30:27 -05:00
Dave Collins
1b73e9828d Relicense to the btcsuite developers. 2015-05-01 12:41:58 -05:00
Dave Collins
e330838900 Remove error return from Block.Sha function.
This commit remove the error return from the Block.Sha function since it
can never fail and ends up causing a lot of unneeded error checking
throughout the code base.
2015-04-17 00:42:08 -05:00
Dave Collins
80b97479bd Update btcwire path import paths to new location. 2015-02-05 14:48:38 -06:00
Dave Collins
fdc00f8eff Update btcwire import paths to new location. 2015-01-16 15:26:50 -06:00
Dave Collins
506d333934 Update btcutil import paths to new location. 2015-01-15 15:13:38 -06:00
Jonathan Gillham
a5298a643e Changed TxIn.PreviousOutpoint to TxIn.PreviousOutPoint after btcwire API change. 2014-10-01 13:54:42 +01:00
Dave Collins
6c4b5928ab goimports -w . 2014-07-02 19:29:48 -05:00
Dave Collins
2db41b1f56 Remove deprecated TxShas func from btcutil.Block.
This commit removes the previously deprecated TxShas function from
btcutil.Block.  The preferred method to access transaction hashes is via
the Sha function on each btcutil.Tx contained within the block.

For example, the following illustrates how convert the old TxShas approach
to the new method:

OLD:

for i, sha := range block.TxShas() {
	// use sha
}

NEW:

for i, tx := range block.Transactions() {
	// use tx.Sha()
}

This commit also updates the tests for the removed function.
2014-03-24 13:56:43 -05:00
David Hill
ca515e278d gofmt 2014-02-04 16:15:14 -05:00
Dave Collins
4edc4ceb9e Update for recent btcwire API changes. 2014-01-18 20:59:07 -06:00
Dave Collins
2af3c8263a Add 2014 to copyright dates. 2014-01-08 23:46:05 -06:00
Dave Collins
93e46b9ffd Add tests for new Block API functions.
This commit adds both positive and negative tests for the new Tx and
Transactions Block API functions.

This is part of the ongoing transaction hash optimization effort noted in
conformal/btcd#25.
2013-10-28 10:55:55 -05:00
Dave Collins
ad7e3894c7 Allow var def to infer type from right-hand side.
Found by golint.
2013-08-06 12:37:20 -05:00
Dave Collins
43095c66bc Remove dependency on protocol version.
This commit unfortunately changes the public API of Block which I
ordinarily don't like to do, but in this case, I felt it was necessary.

The blocks used throughout the database and elsewhere should be indepedent
of the protocol version which is used to encode the block to wire format.
Each block has its own Version field which should be the deciding factor
for the serialization and deserialization of blocks.  In practice, they
are currently the same encoding, but that may not always be the case, and
it's important the blocks are stable depending on their own version
regardless of the protocol version.

This makes use of the new Serialize and Deserialize functions on MsgBlock
which are intended for long-term storage as opposed to wire encoding.
2013-08-05 16:28:55 -05:00
Dave Collins
05d31cdc7a Add negative test for TxLoc. 2013-05-30 11:50:58 -05:00
Dave Collins
3ffe28e364 Add test for OutOfRangeError. 2013-05-30 11:12:29 -05:00
Dave Collins
a5bb254ac6 Add negative tests for TxSha. 2013-05-30 11:06:09 -05:00
Dave Collins
f8fc23a541 Add negative test for NewBlockFromBytes. 2013-05-30 10:45:38 -05:00
Dave Collins
b90727cc8a Add tests for TxLoc. 2013-05-30 10:30:04 -05:00
Dave Collins
ef6c01960f Initial implementation. 2013-05-28 18:21:26 -05:00