Fix linting errors
This commit is contained in:
parent
f28c6bcf61
commit
8851c649d5
@ -61,137 +61,137 @@ func Test_GetAddrDescFromAddress_Mainnet(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
testTx1 bchain.Tx
|
testTx1 bchain.Tx
|
||||||
testTxPacked1 = "0004bd8d8ab4b387540100000002128690c8080ff5b648ad4e38e391f28843cb92c55fe1611a952ea3c9b8eafb2f000000006a47304402200df61ba8dcc1b7228f50eb40346ad237a1d5fae9445a4251f3acfce5728148c402202c43452804855fc08f42fe7db612d9f622a5ee46044279a7a9f7f7c18154a1a1012102248a489fb192cdf37124e15a898f08794a42c5ae2cab3de09a6f92073ae6c904ffffffffe0e35a761650d32866b56d5b4417acd5c6be9d27517be55682da1c4fe83fc6e2010000006c493046022100c40143c5fb6051986921b42565dd20f3201ff1a5365bf0d4110ab0f33c38b22d022100e851372081f381a3edee1b74b54dc6a7806fee6b152a2be855d6bc39974b461a0121028f6f386e276c56ea7ff8894c417a20e82c488ac51400fe51f41c2a243e2de736ffffffff0245420f00000000001976a914d7ea06ca9357862a9d5855cc54ceb093e69a4bc088acb86ef808000000001976a914f943a1cc03a501143ad57fd82394c2952b99e47888ac00000000"
|
testTxPacked1 = "0004bd8d8ab4b387540100000002128690c8080ff5b648ad4e38e391f28843cb92c55fe1611a952ea3c9b8eafb2f000000006a47304402200df61ba8dcc1b7228f50eb40346ad237a1d5fae9445a4251f3acfce5728148c402202c43452804855fc08f42fe7db612d9f622a5ee46044279a7a9f7f7c18154a1a1012102248a489fb192cdf37124e15a898f08794a42c5ae2cab3de09a6f92073ae6c904ffffffffe0e35a761650d32866b56d5b4417acd5c6be9d27517be55682da1c4fe83fc6e2010000006c493046022100c40143c5fb6051986921b42565dd20f3201ff1a5365bf0d4110ab0f33c38b22d022100e851372081f381a3edee1b74b54dc6a7806fee6b152a2be855d6bc39974b461a0121028f6f386e276c56ea7ff8894c417a20e82c488ac51400fe51f41c2a243e2de736ffffffff0245420f00000000001976a914d7ea06ca9357862a9d5855cc54ceb093e69a4bc088acb86ef808000000001976a914f943a1cc03a501143ad57fd82394c2952b99e47888ac00000000"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
testTx1 = bchain.Tx{
|
testTx1 = bchain.Tx{
|
||||||
Hex: "0100000002128690c8080ff5b648ad4e38e391f28843cb92c55fe1611a952ea3c9b8eafb2f000000006a47304402200df61ba8dcc1b7228f50eb40346ad237a1d5fae9445a4251f3acfce5728148c402202c43452804855fc08f42fe7db612d9f622a5ee46044279a7a9f7f7c18154a1a1012102248a489fb192cdf37124e15a898f08794a42c5ae2cab3de09a6f92073ae6c904ffffffffe0e35a761650d32866b56d5b4417acd5c6be9d27517be55682da1c4fe83fc6e2010000006c493046022100c40143c5fb6051986921b42565dd20f3201ff1a5365bf0d4110ab0f33c38b22d022100e851372081f381a3edee1b74b54dc6a7806fee6b152a2be855d6bc39974b461a0121028f6f386e276c56ea7ff8894c417a20e82c488ac51400fe51f41c2a243e2de736ffffffff0245420f00000000001976a914d7ea06ca9357862a9d5855cc54ceb093e69a4bc088acb86ef808000000001976a914f943a1cc03a501143ad57fd82394c2952b99e47888ac00000000",
|
Hex: "0100000002128690c8080ff5b648ad4e38e391f28843cb92c55fe1611a952ea3c9b8eafb2f000000006a47304402200df61ba8dcc1b7228f50eb40346ad237a1d5fae9445a4251f3acfce5728148c402202c43452804855fc08f42fe7db612d9f622a5ee46044279a7a9f7f7c18154a1a1012102248a489fb192cdf37124e15a898f08794a42c5ae2cab3de09a6f92073ae6c904ffffffffe0e35a761650d32866b56d5b4417acd5c6be9d27517be55682da1c4fe83fc6e2010000006c493046022100c40143c5fb6051986921b42565dd20f3201ff1a5365bf0d4110ab0f33c38b22d022100e851372081f381a3edee1b74b54dc6a7806fee6b152a2be855d6bc39974b461a0121028f6f386e276c56ea7ff8894c417a20e82c488ac51400fe51f41c2a243e2de736ffffffff0245420f00000000001976a914d7ea06ca9357862a9d5855cc54ceb093e69a4bc088acb86ef808000000001976a914f943a1cc03a501143ad57fd82394c2952b99e47888ac00000000",
|
||||||
Blocktime: 1397121514,
|
Blocktime: 1397121514,
|
||||||
Txid: "9888815899d3b2e0f26b1eab51229082cf1faf4cd03a12fea2c8afa66701541f",
|
Txid: "9888815899d3b2e0f26b1eab51229082cf1faf4cd03a12fea2c8afa66701541f",
|
||||||
LockTime: 0,
|
LockTime: 0,
|
||||||
Version: 1,
|
Version: 1,
|
||||||
Vin: []bchain.Vin{
|
Vin: []bchain.Vin{
|
||||||
{
|
{
|
||||||
ScriptSig: bchain.ScriptSig{
|
ScriptSig: bchain.ScriptSig{
|
||||||
Hex: "47304402200df61ba8dcc1b7228f50eb40346ad237a1d5fae9445a4251f3acfce5728148c402202c43452804855fc08f42fe7db612d9f622a5ee46044279a7a9f7f7c18154a1a1012102248a489fb192cdf37124e15a898f08794a42c5ae2cab3de09a6f92073ae6c904",
|
Hex: "47304402200df61ba8dcc1b7228f50eb40346ad237a1d5fae9445a4251f3acfce5728148c402202c43452804855fc08f42fe7db612d9f622a5ee46044279a7a9f7f7c18154a1a1012102248a489fb192cdf37124e15a898f08794a42c5ae2cab3de09a6f92073ae6c904",
|
||||||
},
|
},
|
||||||
Txid: "2ffbeab8c9a32e951a61e15fc592cb4388f291e3384ead48b6f50f08c8908612",
|
Txid: "2ffbeab8c9a32e951a61e15fc592cb4388f291e3384ead48b6f50f08c8908612",
|
||||||
Vout: 0,
|
Vout: 0,
|
||||||
Sequence: 4294967295,
|
Sequence: 4294967295,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ScriptSig: bchain.ScriptSig{
|
ScriptSig: bchain.ScriptSig{
|
||||||
Hex: "493046022100c40143c5fb6051986921b42565dd20f3201ff1a5365bf0d4110ab0f33c38b22d022100e851372081f381a3edee1b74b54dc6a7806fee6b152a2be855d6bc39974b461a0121028f6f386e276c56ea7ff8894c417a20e82c488ac51400fe51f41c2a243e2de736",
|
Hex: "493046022100c40143c5fb6051986921b42565dd20f3201ff1a5365bf0d4110ab0f33c38b22d022100e851372081f381a3edee1b74b54dc6a7806fee6b152a2be855d6bc39974b461a0121028f6f386e276c56ea7ff8894c417a20e82c488ac51400fe51f41c2a243e2de736",
|
||||||
},
|
},
|
||||||
Txid: "e2c63fe84f1cda8256e57b51279dbec6d5ac17445b6db56628d35016765ae3e0",
|
Txid: "e2c63fe84f1cda8256e57b51279dbec6d5ac17445b6db56628d35016765ae3e0",
|
||||||
Vout: 1,
|
Vout: 1,
|
||||||
Sequence: 4294967295,
|
Sequence: 4294967295,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Vout: []bchain.Vout{
|
Vout: []bchain.Vout{
|
||||||
{
|
{
|
||||||
ValueSat: *big.NewInt(1000005),
|
ValueSat: *big.NewInt(1000005),
|
||||||
N: 0,
|
N: 0,
|
||||||
ScriptPubKey: bchain.ScriptPubKey{
|
ScriptPubKey: bchain.ScriptPubKey{
|
||||||
Hex: "76a914d7ea06ca9357862a9d5855cc54ceb093e69a4bc088ac",
|
Hex: "76a914d7ea06ca9357862a9d5855cc54ceb093e69a4bc088ac",
|
||||||
Addresses: []string{
|
Addresses: []string{
|
||||||
"ued4doshafG2qqzGZ5T7RBEm34sdMVm46e",
|
"ued4doshafG2qqzGZ5T7RBEm34sdMVm46e",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ValueSat: *big.NewInt(150499000),
|
ValueSat: *big.NewInt(150499000),
|
||||||
N: 1,
|
N: 1,
|
||||||
ScriptPubKey: bchain.ScriptPubKey{
|
ScriptPubKey: bchain.ScriptPubKey{
|
||||||
Hex: "76a914f943a1cc03a501143ad57fd82394c2952b99e47888ac",
|
Hex: "76a914f943a1cc03a501143ad57fd82394c2952b99e47888ac",
|
||||||
Addresses: []string{
|
Addresses: []string{
|
||||||
"uhfQH3AD3huadZuzHTB7TWHoWXbJpJhS6B",
|
"uhfQH3AD3huadZuzHTB7TWHoWXbJpJhS6B",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_PackTx(t *testing.T) {
|
func Test_PackTx(t *testing.T) {
|
||||||
type args struct {
|
type args struct {
|
||||||
tx bchain.Tx
|
tx bchain.Tx
|
||||||
height uint32
|
height uint32
|
||||||
blockTime int64
|
blockTime int64
|
||||||
parser *UnobtaniumParser
|
parser *UnobtaniumParser
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
args args
|
args args
|
||||||
want string
|
want string
|
||||||
wantErr bool
|
wantErr bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "Unobtanium-1",
|
name: "Unobtanium-1",
|
||||||
args: args{
|
args: args{
|
||||||
tx: testTx1,
|
tx: testTx1,
|
||||||
height: 310669,
|
height: 310669,
|
||||||
blockTime: 1397121514,
|
blockTime: 1397121514,
|
||||||
parser: NewUnobtaniumParser(GetChainParams("main"), &btc.Configuration{}),
|
parser: NewUnobtaniumParser(GetChainParams("main"), &btc.Configuration{}),
|
||||||
},
|
},
|
||||||
want: testTxPacked1,
|
want: testTxPacked1,
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
got, err := tt.args.parser.PackTx(&tt.args.tx, tt.args.height, tt.args.blockTime)
|
got, err := tt.args.parser.PackTx(&tt.args.tx, tt.args.height, tt.args.blockTime)
|
||||||
if (err != nil) != tt.wantErr {
|
if (err != nil) != tt.wantErr {
|
||||||
t.Errorf("packTx() error = %v, wantErr %v", err, tt.wantErr)
|
t.Errorf("packTx() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
h := hex.EncodeToString(got)
|
h := hex.EncodeToString(got)
|
||||||
if !reflect.DeepEqual(h, tt.want) {
|
if !reflect.DeepEqual(h, tt.want) {
|
||||||
t.Errorf("packTx() = %v, want %v", h, tt.want)
|
t.Errorf("packTx() = %v, want %v", h, tt.want)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_UnpackTx(t *testing.T) {
|
func Test_UnpackTx(t *testing.T) {
|
||||||
type args struct {
|
type args struct {
|
||||||
packedTx string
|
packedTx string
|
||||||
parser *UnobtaniumParser
|
parser *UnobtaniumParser
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
args args
|
args args
|
||||||
want *bchain.Tx
|
want *bchain.Tx
|
||||||
want1 uint32
|
want1 uint32
|
||||||
wantErr bool
|
wantErr bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "Unobtanium-1",
|
name: "Unobtanium-1",
|
||||||
args: args{
|
args: args{
|
||||||
packedTx: testTxPacked1,
|
packedTx: testTxPacked1,
|
||||||
parser: NewUnobtaniumParser(GetChainParams("main"), &btc.Configuration{}),
|
parser: NewUnobtaniumParser(GetChainParams("main"), &btc.Configuration{}),
|
||||||
},
|
},
|
||||||
want: &testTx1,
|
want: &testTx1,
|
||||||
want1: 310669,
|
want1: 310669,
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
b, _ := hex.DecodeString(tt.args.packedTx)
|
b, _ := hex.DecodeString(tt.args.packedTx)
|
||||||
got, got1, err := tt.args.parser.UnpackTx(b)
|
got, got1, err := tt.args.parser.UnpackTx(b)
|
||||||
if (err != nil) != tt.wantErr {
|
if (err != nil) != tt.wantErr {
|
||||||
t.Errorf("unpackTx() error = %v, wantErr %v", err, tt.wantErr)
|
t.Errorf("unpackTx() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(got, tt.want) {
|
if !reflect.DeepEqual(got, tt.want) {
|
||||||
t.Errorf("unpackTx() got = %v, want %v", got, tt.want)
|
t.Errorf("unpackTx() got = %v, want %v", got, tt.want)
|
||||||
}
|
}
|
||||||
if got1 != tt.want1 {
|
if got1 != tt.want1 {
|
||||||
t.Errorf("unpackTx() got1 = %v, want %v", got1, tt.want1)
|
t.Errorf("unpackTx() got1 = %v, want %v", got1, tt.want1)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,9 +36,9 @@
|
|||||||
| Flo | 9066 | 9166 | 8066 | 38366 |
|
| Flo | 9066 | 9166 | 8066 | 38366 |
|
||||||
| Polis | 9067 | 9167 | 8067 | 38367 |
|
| Polis | 9067 | 9167 | 8067 | 38367 |
|
||||||
| Qtum | 9088 | 9188 | 8088 | 38388 |
|
| Qtum | 9088 | 9188 | 8088 | 38388 |
|
||||||
| Unobtanium | 9092 | 9192 | 65535 | 38392 |
|
|
||||||
| Divi Project | 9089 | 9189 | 8089 | 38389 |
|
| Divi Project | 9089 | 9189 | 8089 | 38389 |
|
||||||
| CPUchain | 9090 | 9190 | 8090 | 38390 |
|
| CPUchain | 9090 | 9190 | 8090 | 38390 |
|
||||||
|
| Unobtanium | 9092 | 9192 | 65535 | 38392 |
|
||||||
| Bitcoin Testnet | 19030 | 19130 | 18030 | 48330 |
|
| Bitcoin Testnet | 19030 | 19130 | 18030 | 48330 |
|
||||||
| Bitcoin Cash Testnet | 19031 | 19131 | 18031 | 48331 |
|
| Bitcoin Cash Testnet | 19031 | 19131 | 18031 | 48331 |
|
||||||
| Zcash Testnet | 19032 | 19132 | 18032 | 48332 |
|
| Zcash Testnet | 19032 | 19132 | 18032 | 48332 |
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user