Skip to content

Commit

Permalink
this commit does the following:
Browse files Browse the repository at this point in the history
- all the fungible tests have OnlyUnit set to true.
- RestoreTMS will only take care of the Pending transaction.
The git issue (#766)
tracks the restructuring of the checks and recovery functions

Signed-off-by: Angelo De Caro <[email protected]>
  • Loading branch information
adecaro committed Sep 26, 2024
1 parent 771e673 commit 3f628d0
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions integration/token/fungible/dloghsm/dlog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func newTestSuite(commType fsc.P2PCommunicationType, mask int, factor int, names
WebEnabled: mask&WebEnabled > 0,
SDKs: []api.SDK{&fdlog.SDK{}},
ReplicationOpts: opts,
OnlyUnity: true,
},
))
return ts, selector
Expand Down
1 change: 1 addition & 0 deletions integration/token/fungible/fabtoken/fabtoken_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func newTestSuite(commType fsc.P2PCommunicationType, factor int, names ...string
ReplicationOpts: opts,
WebEnabled: true, // Needed for the Remote Wallet with websockets
//FSCLogSpec: "token-sdk=debug:fabric-sdk=debug:info",
OnlyUnity: true,
},
))
return ts, selector
Expand Down
1 change: 1 addition & 0 deletions integration/token/fungible/odlog/dlog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func newTestSuite(commType fsc.P2PCommunicationType, factor int, names ...string
//FSCLogSpec: "token-sdk=debug:orion-sdk=debug:info",
//FSCLogSpec: "token-sdk=debug:orion-sdk=debug:view-sdk.services.comm=debug:info",
ReplicationOpts: opts,
OnlyUnity: true,
},
))
return ts, selector
Expand Down
1 change: 1 addition & 0 deletions integration/token/fungible/ofabtoken/fabtoken_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func newTestSuite(commType fsc.P2PCommunicationType, factor int, names ...string
Aries: true,
SDKs: []api.SDK{&ofabtoken.SDK{}},
ReplicationOpts: opts,
OnlyUnity: true,
},
))
return ts, selector
Expand Down
3 changes: 2 additions & 1 deletion token/services/auditor/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func (cm *Manager) Auditor(tmsID token.TMSID) (*Auditor, error) {
return cm.getAuditor(tmsID)
}

// RestoreTMS restores the auditdb corresponding to the passed TMS ID.
func (cm *Manager) RestoreTMS(tmsID token.TMSID) error {
logger.Infof("restore audit dbs for entry [%s]...", tmsID)
if err := cm.restore(tmsID); err != nil {
Expand Down Expand Up @@ -134,7 +135,7 @@ func (cm *Manager) restore(tmsID token.TMSID) error {
if err != nil {
return errors.WithMessagef(err, "failed to get auditor for [%s]", tmsID)
}
it, err := auditor.auditDB.TokenRequests(auditdb.QueryTokenRequestsParams{Statuses: []TxStatus{auditdb.Pending, auditdb.Unknown, auditdb.Deleted}})
it, err := auditor.auditDB.TokenRequests(auditdb.QueryTokenRequestsParams{Statuses: []TxStatus{auditdb.Pending}})
if err != nil {
return errors.Errorf("failed to get tx iterator for [%s]", tmsID)
}
Expand Down
2 changes: 1 addition & 1 deletion token/services/tokens/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (t *Tokens) Append(ctx context.Context, tmsID token.TMSID, txID string, req
if err = ts.Commit(); err != nil {
return errors.WithMessagef(err, "transaction [%s], failed to commit tokens to database", txID)
}
logger.Debugf("transaction [%s], committed tokens to database", txID)
logger.Debugf("transaction [%s], committed tokens [%d:%d] to database", txID, len(toAppend), len(toSpend))

return nil
}
Expand Down
3 changes: 2 additions & 1 deletion token/services/ttx/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func (m *Manager) newDB(tmsID token.TMSID) (*DB, error) {
return wrapper, nil
}

// RestoreTMS restores the auditdb corresponding to the passed TMS ID.
func (m *Manager) RestoreTMS(tmsID token.TMSID) error {
net, err := m.networkProvider.GetNetwork(tmsID.Network, tmsID.Channel)
if err != nil {
Expand All @@ -119,7 +120,7 @@ func (m *Manager) RestoreTMS(tmsID token.TMSID) error {
return errors.WithMessagef(err, "failed to get db for [%s:%s]", tmsID.Network, tmsID.Channel)
}

it, err := db.ttxDB.TokenRequests(ttxdb.QueryTokenRequestsParams{Statuses: []TxStatus{driver.Pending, driver.Unknown, driver.Deleted}})
it, err := db.ttxDB.TokenRequests(ttxdb.QueryTokenRequestsParams{Statuses: []TxStatus{driver.Pending}})
if err != nil {
return errors.WithMessagef(err, "failed to get tx iterator for [%s:%s:%s]", tmsID.Network, tmsID.Channel, tmsID)
}
Expand Down

0 comments on commit 3f628d0

Please sign in to comment.