diff --git a/common/model/event.pb.go b/common/model/event.pb.go index f54a22070..23558b666 100644 --- a/common/model/event.pb.go +++ b/common/model/event.pb.go @@ -33,19 +33,21 @@ const ( EventType_EventRemoveAccountDatasetTransaction EventType = 7 EventType_EventReward EventType = 8 EventType_EventApprovalEscrowTransaction EventType = 9 + EventType_EventMultiSignatureTransaction EventType = 10 ) var EventType_name = map[int32]string{ - 0: "EventAny", - 1: "EventSendMoneyTransaction", - 2: "EventNodeRegistrationTransaction", - 3: "EventUpdateNodeRegistrationTransaction", - 4: "EventRemoveNodeRegistrationTransaction", - 5: "EventClaimNodeRegistrationTransaction", - 6: "EventSetupAccountDatasetTransaction", - 7: "EventRemoveAccountDatasetTransaction", - 8: "EventReward", - 9: "EventApprovalEscrowTransaction", + 0: "EventAny", + 1: "EventSendMoneyTransaction", + 2: "EventNodeRegistrationTransaction", + 3: "EventUpdateNodeRegistrationTransaction", + 4: "EventRemoveNodeRegistrationTransaction", + 5: "EventClaimNodeRegistrationTransaction", + 6: "EventSetupAccountDatasetTransaction", + 7: "EventRemoveAccountDatasetTransaction", + 8: "EventReward", + 9: "EventApprovalEscrowTransaction", + 10: "EventMultiSignatureTransaction", } var EventType_value = map[string]int32{ @@ -59,6 +61,7 @@ var EventType_value = map[string]int32{ "EventRemoveAccountDatasetTransaction": 7, "EventReward": 8, "EventApprovalEscrowTransaction": 9, + "EventMultiSignatureTransaction": 10, } func (x EventType) String() string { @@ -76,22 +79,23 @@ func init() { func init() { proto.RegisterFile("model/event.proto", fileDescriptor_24dabb9f57ff37c9) } var fileDescriptor_24dabb9f57ff37c9 = []byte{ - // 263 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0xd1, 0xb1, 0x4e, 0xf3, 0x30, - 0x10, 0x07, 0xf0, 0xef, 0x2b, 0xb4, 0xb4, 0x07, 0x12, 0xe1, 0x36, 0x06, 0x10, 0x82, 0x02, 0x25,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e, 0xd7, 0xed, 0x4b, 0xa3, 0xc7, 0xf8, 0x63, 0xb2, 0xca, 0xe5, - 0xb3, 0x4a, 0xa7, 0x9a, 0x4d, 0xf2, 0xc5, 0x9c, 0xea, 0xed, 0x79, 0xaf, 0xd9, 0x53, 0xa2, 0xd9, - 0x18, 0xb6, 0x49, 0xc8, 0x25, 0x1d, 0x84, 0x94, 0x1e, 0x7e, 0x02, 0x00, 0x00, 0xff, 0xff, 0xdd, - 0xce, 0x1d, 0xb4, 0xba, 0x01, 0x00, 0x00, + // 275 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0xd1, 0xb1, 0x4e, 0xc3, 0x30, + 0x10, 0x06, 0x60, 0xa0, 0xb4, 0xb4, 0x07, 0x12, 0xc5, 0x1b, 0x03, 0x08, 0x41, 0x81, 0x12, 0x89, + 0x66, 0xe0, 0x09, 0x0a, 0x74, 0x2c, 0x43, 0x5b, 0x16, 0x36, 0xc7, 0x39, 0x05, 0x4b, 0xb1, 0xcf, + 0x72, 0x2e, 0xa9, 0xc2, 0x3b, 0xf0, 0xce, 0xa8, 0x6e, 0x55, 0x65, 0x21, 0x8b, 0xa5, 0xbb, 0xfb, + 0x2c, 0xcb, 0xf7, 0xc3, 0x85, 0xa1, 0x14, 0xf3, 0x18, 0x2b, 0xb4, 0x3c, 0x71, 0x9e, 0x98, 0x44, + 0x37, 0xb4, 0xa2, 0xdf, 0x0e, 0x0c, 0x66, 0x9b, 0xf6, 0xaa, 0x76, 0x28, 0xce, 0xa0, 0x1f, 0x8a, + 0xa9, 0xad, 0x87, 0x07, 0xe2, 0x0a, 0x2e, 0x43, 0xb5, 0x44, 0x9b, 0xce, 0xc9, 0x62, 0xbd, 0xf2, + 0xd2, 0x16, 0x52, 0xb1, 0x26, 0x3b, 0x3c, 0x14, 0x23, 0xb8, 0x09, 0xe3, 0x0f, 0x4a, 0x71, 0x81, + 0x99, 0x2e, 0xd8, 0xcb, 0xcd, 0xa8, 0xa9, 0x8e, 0x44, 0x04, 0x0f, 0x41, 0x7d, 0xba, 0x54, 0x32, + 0xb6, 0xd9, 0xce, 0xde, 0x2e, 0xd0, 0x50, 0xd5, 0x6a, 0x8f, 0xc5, 0x13, 0xdc, 0x07, 0xfb, 0x96, + 0x4b, 0x6d, 0xda, 0x68, 0x57, 0x3c, 0xc2, 0xdd, 0xee, 0x1f, 0x5c, 0xba, 0xa9, 0x52, 0x54, 0x5a, + 0x7e, 0x97, 0x2c, 0x0b, 0xe4, 0x26, 0xec, 0x89, 0x31, 0x8c, 0x1a, 0xef, 0xff, 0x2f, 0x4f, 0xc4, + 0x39, 0x9c, 0xee, 0xe4, 0x5a, 0xfa, 0x74, 0xd8, 0x17, 0xb7, 0x70, 0xbd, 0xdd, 0x9c, 0x73, 0x9e, + 0x2a, 0x99, 0xcf, 0x0a, 0xe5, 0x69, 0xdd, 0xbc, 0x34, 0xd8, 0x9b, 0x79, 0x99, 0xb3, 0x5e, 0xea, + 0xcc, 0x4a, 0x2e, 0x3d, 0x36, 0x0d, 0xbc, 0x46, 0x5f, 0xe3, 0x4c, 0xf3, 0x77, 0x99, 0x4c, 0x14, + 0x99, 0xf8, 0x87, 0x28, 0x51, 0xdb, 0xf3, 0x59, 0x91, 0xc7, 0x58, 0x91, 0x31, 0x64, 0xe3, 0x90, + 0x5d, 0xd2, 0x0b, 0x49, 0xbe, 0xfc, 0x05, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x74, 0xd4, 0x38, 0xde, + 0x01, 0x00, 0x00, } diff --git a/common/schema b/common/schema index da8458b70..bf39e2a10 160000 --- a/common/schema +++ b/common/schema @@ -1 +1 @@ -Subproject commit da8458b700eada69abfede8c49d2481c3a686ee2 +Subproject commit bf39e2a1082ee310d2826453e577fcc076dc3b6d diff --git a/common/transaction/multiSignature.go b/common/transaction/multiSignature.go index 959af6ca4..8c2479ef3 100644 --- a/common/transaction/multiSignature.go +++ b/common/transaction/multiSignature.go @@ -22,6 +22,7 @@ type ( // MultiSignatureTransaction represent wrapper transaction type that require multiple signer to approve the transcaction // wrapped MultiSignatureTransaction struct { + ID int64 SenderAddress string Fee int64 QueryExecutor query.ExecutorInterface @@ -39,6 +40,7 @@ type ( PendingTransactionQuery query.PendingTransactionQueryInterface PendingSignatureQuery query.PendingSignatureQueryInterface TransactionQuery query.TransactionQueryInterface + AccountLedgerQuery query.AccountLedgerQueryInterface } ) @@ -171,6 +173,19 @@ func (tx *MultiSignatureTransaction) ApplyConfirmed(blockTimestamp int64) error return err } } + // sender ledger + senderAccountLedgerQ, senderAccountLedgerArgs := tx.AccountLedgerQuery.InsertAccountLedger(&model.AccountLedger{ + AccountAddress: tx.SenderAddress, + BalanceChange: -tx.Fee, + TransactionID: tx.ID, + BlockHeight: tx.Height, + EventType: model.EventType_EventMultiSignatureTransaction, + Timestamp: uint64(blockTimestamp), + }) + err = tx.QueryExecutor.ExecuteTransaction(senderAccountLedgerQ, senderAccountLedgerArgs...) + if err != nil { + return err + } return nil } diff --git a/common/transaction/transaction.go b/common/transaction/transaction.go index 21f891930..7cca000d8 100644 --- a/common/transaction/transaction.go +++ b/common/transaction/transaction.go @@ -241,7 +241,10 @@ func (ts *TypeSwitcher) GetTransactionType(tx *model.Transaction) (TypeAction, e return nil, err } return &MultiSignatureTransaction{ + ID: tx.ID, Body: multiSigTransactionBody.(*model.MultiSignatureTransactionBody), + Fee: tx.GetFee(), + SenderAddress: tx.GetSenderAccountAddress(), NormalFee: fee.NewConstantFeeModel(constant.OneZBC / 100), TransactionUtil: &Util{}, TypeSwitcher: &TypeSwitcher{ @@ -257,6 +260,7 @@ func (ts *TypeSwitcher) GetTransactionType(tx *model.Transaction) (TypeAction, e PendingTransactionQuery: query.NewPendingTransactionQuery(), PendingSignatureQuery: query.NewPendingSignatureQuery(), TransactionQuery: query.NewTransactionQuery(&chaintype.MainChain{}), + AccountLedgerQuery: query.NewAccountLedgerQuery(), }, nil default: return nil, nil