Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Commit 113a4f9

Browse files
author
GitHub
committed
Automatic update on Mon Jul 4 01:08:14 UTC 2022
1 parent 8f88432 commit 113a4f9

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

pkg/cothority/calypso/contracts.go

+12
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,18 @@ func (c ContractWrite) Spawn(rst byzcoin.ReadOnlyStateTrie, inst byzcoin.Instruc
7979
err = xerrors.Errorf("proof of write failed: %v", err)
8080
return
8181
}
82+
var cid string
83+
_, _, cid, _, err = rst.GetValues(c.Write.LTSID[:])
84+
if err != nil {
85+
err = xerrors.Errorf("couldn't find the corresponding LTSID: %v",
86+
err)
87+
return
88+
}
89+
if cid != ContractLongTermSecretID {
90+
err = xerrors.Errorf("given LTSID points to wrong contract: %s",
91+
cid)
92+
return
93+
}
8294
instID, err := inst.DeriveIDArg("", "preID")
8395
if err != nil {
8496
return nil, nil, xerrors.Errorf(

pkg/cothority/personhood/contracts/contract_spawner_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ func TestContractSpawnerPreID(t *testing.T) {
197197
testPreID(t, sr, instCred, ca, null, false)
198198

199199
ltsID := byzcoin.NewInstanceID(random.Bits(256, true, random.New()))
200+
require.NoError(t, sr.CreateSCB(byzcoin.Create,
201+
calypso.ContractLongTermSecretID, ltsID, nil, nil))
200202
ltsKP := key.NewKeyPair(cothority.Suite)
201203
wr := calypso.NewWrite(cothority.Suite, ltsID,
202204
darc.ID{}, ltsKP.Public, []byte("key"))

0 commit comments

Comments
 (0)