import (
"context"
stdjson "encoding/json"
+ "fmt"
"time"
log "github.com/sirupsen/logrus"
return txbuilder.MissingFieldsError(missing...)
}
+ sourceKey := []byte(fmt.Sprintf("SC:%v:%v", a.SourceID, a.SourcePos))
+ a.reg.assetMu.Lock()
+ defer a.reg.assetMu.Unlock()
+ if existed := a.reg.db.Get(sourceKey); existed != nil {
+ return errors.New("mainchain output double spent")
+ }
+
var err error
asset := &Asset{}
if preAsset, _ := a.reg.GetAsset(a.AssetId.String()); preAsset != nil {
builder.RestrictMinTime(time.Now())
tplIn := &txbuilder.SigningInstruction{}
tplIn.AddRawWitnessKeys(assetSigner.XPubs, path, assetSigner.Quorum)
+ a.reg.db.Set(sourceKey, []byte("true"))
return builder.AddInput(txin, tplIn)
}