transaction: allow system fee specification in NewInvocationTX

It's not possible to create any deployment TX without it.
This commit is contained in:
Roman Khimov 2019-11-19 20:23:14 +03:00
parent d93499cc6f
commit 27a57e1a2d
2 changed files with 3 additions and 2 deletions

View file

@ -17,12 +17,13 @@ type InvocationTX struct {
} }
// NewInvocationTX returns a new invocation transaction. // NewInvocationTX returns a new invocation transaction.
func NewInvocationTX(script []byte) *Transaction { func NewInvocationTX(script []byte, gas util.Fixed8) *Transaction {
return &Transaction{ return &Transaction{
Type: InvocationType, Type: InvocationType,
Version: 1, Version: 1,
Data: &InvocationTX{ Data: &InvocationTX{
Script: script, Script: script,
Gas: gas,
Version: 1, Version: 1,
}, },
Attributes: []*Attribute{}, Attributes: []*Attribute{},

View file

@ -98,7 +98,7 @@ func TestDecodeEncodeInvocationTX(t *testing.T) {
func TestNewInvocationTX(t *testing.T) { func TestNewInvocationTX(t *testing.T) {
script := []byte{0x51} script := []byte{0x51}
tx := NewInvocationTX(script) tx := NewInvocationTX(script, 1)
txData := tx.Data.(*InvocationTX) txData := tx.Data.(*InvocationTX)
assert.Equal(t, InvocationType, tx.Type) assert.Equal(t, InvocationType, tx.Type)
assert.Equal(t, tx.Version, txData.Version) assert.Equal(t, tx.Version, txData.Version)