core: add issuer hashes into the verification list for Issue TX

As it should be done.
This commit is contained in:
Roman Khimov 2020-03-12 18:06:26 +03:00
parent a9e5cdd6cc
commit 10601cb375

View file

@ -1942,6 +1942,16 @@ func (bc *Blockchain) GetScriptHashesForVerifying(t *transaction.Transaction) ([
case transaction.EnrollmentType: case transaction.EnrollmentType:
etx := t.Data.(*transaction.EnrollmentTX) etx := t.Data.(*transaction.EnrollmentTX)
hashes[etx.PublicKey.GetScriptHash()] = true hashes[etx.PublicKey.GetScriptHash()] = true
case transaction.IssueType:
for _, res := range refsAndOutsToResults(references, t.Outputs) {
if res.Amount < 0 {
asset, err := bc.dao.GetAssetState(res.AssetID)
if asset == nil || err != nil {
return nil, errors.New("invalid asset in issue tx")
}
hashes[asset.Issuer] = true
}
}
case transaction.RegisterType: case transaction.RegisterType:
reg := t.Data.(*transaction.RegisterTX) reg := t.Data.(*transaction.RegisterTX)
hashes[reg.Owner.GetScriptHash()] = true hashes[reg.Owner.GetScriptHash()] = true