Skip to content

Commit

Permalink
DFI-795 Remove round-robin mechanism from issuing new currencies func…
Browse files Browse the repository at this point in the history
…tional (#206)
  • Loading branch information
papa-stiflera authored Dec 3, 2020
1 parent 4c8da42 commit 9a91bd6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/unit_currencies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ func TestCurrenciesApp_Issue(t *testing.T) {
CheckResultError(t, currencies.ErrWrongIssueID, res, err)
}

// fail: currency issue with already existing uniqueMsgID
// fail: currency issue with already approved uniqueMsgID
{
msgId, issueId := "1", "non-existing-issue"
coin := sdk.NewCoin(denom, amount)

res, err := IssueCurrency(t, app, coin, msgId, issueId, recipientIdx, genAccs, genPrivKeys, false)
CheckResultError(t, multisig.ErrWrongCallUniqueId, res, err)
CheckResultError(t, multisig.ErrVoteAlreadyApproved, res, err)
}
}

Expand Down
8 changes: 6 additions & 2 deletions x/multisig/internal/keeper/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ import (
func (k Keeper) SubmitCall(ctx sdk.Context, msg msmodule.MsMsg, uniqueID string, sender sdk.AccAddress) error {
k.modulePerms.AutoCheck(types.PermWrite)

// check call exists
// confirm call if exists
if k.HasCallByUniqueID(ctx, uniqueID) {
return sdkErrors.Wrapf(types.ErrWrongCallUniqueId, "%q exists", uniqueID)
id, err := k.GetCallIDByUniqueID(ctx, uniqueID)
if err != nil {
return err
}
return k.ConfirmCall(ctx, id, sender)
}

// create a new call and check its validity
Expand Down
2 changes: 1 addition & 1 deletion x/multisig/internal/keeper/call_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func TestMSKeeper_SubmitCall_InvalidInputs(t *testing.T) {
// invalid: call
{
msg := NewMockMsMsg(true)
require.Error(t, keeper.SubmitCall(ctx, msg, uniqueID1, sdk.AccAddress{}))
require.NoError(t, keeper.SubmitCall(ctx, msg, uniqueID1, sdk.AccAddress{}))
}

// invalid: non-existing msg route
Expand Down

0 comments on commit 9a91bd6

Please sign in to comment.