OSDN Git Service

fix x86-32 exeception for 64-bit aligned
authoroysheng <oysheng@bytom.io>
Mon, 21 May 2018 02:51:33 +0000 (10:51 +0800)
committeroysheng <oysheng@bytom.io>
Mon, 21 May 2018 02:54:22 +0000 (10:54 +0800)
account/reserve.go

index c0dfbe1..40ff3ba 100644 (file)
@@ -96,9 +96,11 @@ func newReserver(c *protocol.Chain, walletdb dbm.DB) *reserver {
 // reserver ensures idempotency of reservations until the reservation
 // expiration.
 type reserver struct {
+       // `sync/atomic` expects the first word in an allocated struct to be 64-bit
+       // aligned on both ARM and x86-32. See https://goo.gl/zW7dgq for more details.
+       nextReservationID uint64
        c                 *protocol.Chain
        db                dbm.DB
-       nextReservationID uint64
        idempotency       idempotency.Group
 
        reservationsMu sync.Mutex