Ejemplo n.º 1
0
		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()