本文整理匯總了Golang中github.com/hyperledger/fabric/core/ledger.Ledger.RollbackStateDelta方法的典型用法代碼示例。如果您正苦於以下問題:Golang Ledger.RollbackStateDelta方法的具體用法?Golang Ledger.RollbackStateDelta怎麽用?Golang Ledger.RollbackStateDelta使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/hyperledger/fabric/core/ledger.Ledger
的用法示例。
在下文中一共展示了Ledger.RollbackStateDelta方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
It("should return error trying to commit state delta", func() {
delta, _ = ledgerPtr.GetStateDelta(1)
Expect(ledgerPtr.CommitStateDelta(1)).ToNot(BeNil())
})
It("should return error trying to rollback batch", func() {
Expect(ledgerPtr.RollbackTxBatch(1)).ToNot(BeNil())
})
It("should return error trying to apply state delta", func() {
Expect(ledgerPtr.ApplyStateDelta(2, delta)).To(BeNil())
Expect(ledgerPtr.ApplyStateDelta(3, delta)).ToNot(BeNil())
})
It("should return error trying to commit state delta", func() {
Expect(ledgerPtr.CommitStateDelta(3)).ToNot(BeNil())
})
It("should return error trying to rollback state delta", func() {
Expect(ledgerPtr.RollbackStateDelta(3)).ToNot(BeNil())
})
})
Describe("Ledger ApplyDeltaHash", func() {
ledgerPtr := InitSpec()
// Block 0
It("creates, populates, finishes, commits and validates three batches", func() {
Expect(ledgerPtr.BeginTxBatch(0)).To(BeNil())
ledgerPtr.TxBegin("txUuid1")
Expect(ledgerPtr.SetState("chaincode1", "key1", []byte("value1A"))).To(BeNil())
Expect(ledgerPtr.SetState("chaincode2", "key2", []byte("value2A"))).To(BeNil())
Expect(ledgerPtr.SetState("chaincode3", "key3", []byte("value3A"))).To(BeNil())
ledgerPtr.TxFinished("txUuid1", true)
uuid := util.GenerateUUID()