Skip to content

Commit a7ca805

Browse files
committed
fix nonce
1 parent 640eb69 commit a7ca805

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

solana/observer.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -536,17 +536,22 @@ func (node *Node) handleUnconfirmedCalls(ctx context.Context) error {
536536
return err
537537
}
538538
} else {
539+
err := node.OccupyNonceAccountByCall(ctx, nonce, call.RequestId)
540+
if err != nil {
541+
return err
542+
}
543+
539544
cid := common.UniqueId(id, "storage")
540545
fee, err := node.getSystemCallFeeFromXIN(ctx, call)
541546
if err != nil {
542547
return err
543548
}
549+
nonce = node.ReadSpareNonceAccountWithCall(ctx, cid)
544550
tx, err := node.CreatePrepareTransaction(ctx, call, nonce, fee)
545551
if err != nil {
546552
return err
547553
}
548554
if tx != nil {
549-
nonce := node.ReadSpareNonceAccountWithCall(ctx, cid)
550555
err := node.OccupyNonceAccountByCall(ctx, nonce, cid)
551556
if err != nil {
552557
return err
@@ -556,10 +561,8 @@ func (node *Node) handleUnconfirmedCalls(ctx context.Context) error {
556561
panic(err)
557562
}
558563
extra = attachSystemCall(extra, cid, tb)
559-
}
560-
err = node.store.OccupyNonceAccountByCall(ctx, call.NonceAccount, call.RequestId)
561-
if err != nil {
562-
return err
564+
} else {
565+
node.releaseLockedNonceAccount(ctx, nonce)
563566
}
564567
}
565568

0 commit comments

Comments
 (0)