From 6a065d5cfc5eb1933530290b1b39dba7db680eec Mon Sep 17 00:00:00 2001 From: Roland Shoemaker Date: Wed, 6 May 2015 21:48:37 -0700 Subject: [PATCH] reversing part of the transaction cull --- sa/storage-authority.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sa/storage-authority.go b/sa/storage-authority.go index eb885efd4..05b402a86 100644 --- a/sa/storage-authority.go +++ b/sa/storage-authority.go @@ -498,12 +498,24 @@ func (ssa *SQLStorageAuthority) FinalizeAuthorization(authz core.Authorization) } oldAuth := authObj.(*PendingAuthzModel) - err = ssa.dbMap.Insert(auth) + tx, err := ssa.dbMap.Begin() if err != nil { return } - _, err = ssa.dbMap.Delete(oldAuth) + err = tx.Insert(auth) + if err != nil { + tx.Rollback() + return + } + + _, err = tx.Delete(oldAuth) + if err != nil { + tx.Rollback() + return + } + + tx.Commit() return }