blockchain: Run gofmt -s.

Also compress some definitions a bit while simplifying.
This commit is contained in:
Dave Collins 2016-10-27 23:16:07 -05:00
parent f3c442deb2
commit 51a6309cdd
No known key found for this signature in database
GPG key ID: B8904D9D9C93D1F2

View file

@ -186,12 +186,10 @@ func TestCalcSequenceLock(t *testing.T) {
// output.
var fakeScript []byte
unConfTx := &wire.MsgTx{
TxOut: []*wire.TxOut{
&wire.TxOut{
TxOut: []*wire.TxOut{{
PkScript: fakeScript,
Value: 5,
},
},
}},
}
unConfUtxo := wire.OutPoint{
Hash: unConfTx.TxHash(),
@ -204,9 +202,7 @@ func TestCalcSequenceLock(t *testing.T) {
tests := []struct {
tx *btcutil.Tx
view *blockchain.UtxoViewpoint
want *blockchain.SequenceLock
mempool bool
}{
// A transaction of version one should disable sequence locks
@ -215,12 +211,10 @@ func TestCalcSequenceLock(t *testing.T) {
{
tx: btcutil.NewTx(&wire.MsgTx{
Version: 1,
TxIn: []*wire.TxIn{
&wire.TxIn{
TxIn: []*wire.TxIn{{
PreviousOutPoint: utxo,
Sequence: blockchain.LockTimeToSequence(false, 3),
},
},
}},
}),
view: utxoView,
want: &blockchain.SequenceLock{
@ -234,12 +228,10 @@ func TestCalcSequenceLock(t *testing.T) {
{
tx: btcutil.NewTx(&wire.MsgTx{
Version: 2,
TxIn: []*wire.TxIn{
&wire.TxIn{
TxIn: []*wire.TxIn{{
PreviousOutPoint: utxo,
Sequence: wire.MaxTxInSequenceNum,
},
},
}},
}),
view: utxoView,
want: &blockchain.SequenceLock{
@ -256,12 +248,10 @@ func TestCalcSequenceLock(t *testing.T) {
{
tx: btcutil.NewTx(&wire.MsgTx{
Version: 2,
TxIn: []*wire.TxIn{
&wire.TxIn{
TxIn: []*wire.TxIn{{
PreviousOutPoint: utxo,
Sequence: blockchain.LockTimeToSequence(true, 2),
},
},
}},
}),
view: utxoView,
want: &blockchain.SequenceLock{
@ -276,12 +266,10 @@ func TestCalcSequenceLock(t *testing.T) {
{
tx: btcutil.NewTx(&wire.MsgTx{
Version: 2,
TxIn: []*wire.TxIn{
&wire.TxIn{
TxIn: []*wire.TxIn{{
PreviousOutPoint: utxo,
Sequence: blockchain.LockTimeToSequence(true, 1024),
},
},
}},
}),
view: utxoView,
want: &blockchain.SequenceLock{
@ -298,21 +286,17 @@ func TestCalcSequenceLock(t *testing.T) {
{
tx: btcutil.NewTx(&wire.MsgTx{
Version: 2,
TxIn: []*wire.TxIn{
&wire.TxIn{
TxIn: []*wire.TxIn{{
PreviousOutPoint: utxo,
Sequence: blockchain.LockTimeToSequence(true, 2560),
},
&wire.TxIn{
}, {
PreviousOutPoint: utxo,
Sequence: blockchain.LockTimeToSequence(false, 3) |
wire.SequenceLockTimeDisabled,
},
&wire.TxIn{
}, {
PreviousOutPoint: utxo,
Sequence: blockchain.LockTimeToSequence(false, 3),
},
},
}},
}),
view: utxoView,
want: &blockchain.SequenceLock{
@ -328,12 +312,10 @@ func TestCalcSequenceLock(t *testing.T) {
{
tx: btcutil.NewTx(&wire.MsgTx{
Version: 2,
TxIn: []*wire.TxIn{
&wire.TxIn{
TxIn: []*wire.TxIn{{
PreviousOutPoint: utxo,
Sequence: blockchain.LockTimeToSequence(false, 3),
},
},
}},
}),
view: utxoView,
want: &blockchain.SequenceLock{
@ -347,16 +329,13 @@ func TestCalcSequenceLock(t *testing.T) {
{
tx: btcutil.NewTx(&wire.MsgTx{
Version: 2,
TxIn: []*wire.TxIn{
&wire.TxIn{
TxIn: []*wire.TxIn{{
PreviousOutPoint: utxo,
Sequence: blockchain.LockTimeToSequence(true, 5120),
},
&wire.TxIn{
}, {
PreviousOutPoint: utxo,
Sequence: blockchain.LockTimeToSequence(true, 2560),
},
},
}},
}),
view: utxoView,
want: &blockchain.SequenceLock{
@ -371,16 +350,13 @@ func TestCalcSequenceLock(t *testing.T) {
{
tx: btcutil.NewTx(&wire.MsgTx{
Version: 2,
TxIn: []*wire.TxIn{
&wire.TxIn{
TxIn: []*wire.TxIn{{
PreviousOutPoint: utxo,
Sequence: blockchain.LockTimeToSequence(false, 1),
},
&wire.TxIn{
}, {
PreviousOutPoint: utxo,
Sequence: blockchain.LockTimeToSequence(false, 7),
},
},
}},
}),
view: utxoView,
want: &blockchain.SequenceLock{
@ -395,24 +371,19 @@ func TestCalcSequenceLock(t *testing.T) {
{
tx: btcutil.NewTx(&wire.MsgTx{
Version: 2,
TxIn: []*wire.TxIn{
&wire.TxIn{
TxIn: []*wire.TxIn{{
PreviousOutPoint: utxo,
Sequence: blockchain.LockTimeToSequence(true, 2560),
},
&wire.TxIn{
}, {
PreviousOutPoint: utxo,
Sequence: blockchain.LockTimeToSequence(true, 6656),
},
&wire.TxIn{
}, {
PreviousOutPoint: utxo,
Sequence: blockchain.LockTimeToSequence(false, 3),
},
&wire.TxIn{
}, {
PreviousOutPoint: utxo,
Sequence: blockchain.LockTimeToSequence(false, 9),
},
},
}},
}),
view: utxoView,
want: &blockchain.SequenceLock{
@ -428,12 +399,10 @@ func TestCalcSequenceLock(t *testing.T) {
{
tx: btcutil.NewTx(&wire.MsgTx{
Version: 2,
TxIn: []*wire.TxIn{
&wire.TxIn{
TxIn: []*wire.TxIn{{
PreviousOutPoint: unConfUtxo,
Sequence: blockchain.LockTimeToSequence(false, 2),
},
},
}},
}),
view: utxoView,
want: &blockchain.SequenceLock{
@ -447,12 +416,10 @@ func TestCalcSequenceLock(t *testing.T) {
{
tx: btcutil.NewTx(&wire.MsgTx{
Version: 2,
TxIn: []*wire.TxIn{
&wire.TxIn{
TxIn: []*wire.TxIn{{
PreviousOutPoint: unConfUtxo,
Sequence: blockchain.LockTimeToSequence(true, 1024),
},
},
}},
}),
view: utxoView,
want: &blockchain.SequenceLock{