MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / applyTransaction

Method applyTransaction

blockproducer/metastate.go:1129–1156  ·  view source on GitHub ↗
(tx pi.Transaction, height uint32)

Source from the content-addressed store, hash-verified

1127}
1128
1129func (s *metaState) applyTransaction(tx pi.Transaction, height uint32) (err error) {
1130 switch t := tx.(type) {
1131 case *types.Transfer:
1132 err = s.transferSQLChainTokenBalance(t)
1133 if err == ErrDatabaseNotFound {
1134 err = s.transferAccountToken(t)
1135 }
1136 return
1137 case *types.BaseAccount:
1138 err = s.storeBaseAccount(t.Address, &t.Account)
1139 case *types.ProvideService:
1140 err = s.updateProviderList(t, height)
1141 case *types.CreateDatabase:
1142 err = s.matchProvidersWithUser(t)
1143 case *types.UpdatePermission:
1144 err = s.updatePermission(t)
1145 case *types.IssueKeys:
1146 err = s.updateKeys(t)
1147 case *types.UpdateBilling:
1148 err = s.updateBilling(t)
1149 case *pi.TransactionWrapper:
1150 // call again using unwrapped transaction
1151 err = s.applyTransaction(t.Unwrap(), height)
1152 default:
1153 err = ErrUnknownTransactionType
1154 }
1155 return
1156}
1157
1158func (s *metaState) generateGenesisBlock(dbID proto.DatabaseID, tx *types.CreateDatabase) (genesisBlock *types.Block, err error) {
1159 emptyNode := &proto.RawNodeID{}

Callers 2

applyMethod · 0.95
TestMetaStateFunction · 0.80

Calls 9

transferAccountTokenMethod · 0.95
storeBaseAccountMethod · 0.95
updateProviderListMethod · 0.95
updatePermissionMethod · 0.95
updateKeysMethod · 0.95
updateBillingMethod · 0.95
UnwrapMethod · 0.80

Tested by 1

TestMetaStateFunction · 0.64