Ejemplo n.º 1
0
			Expect(state).To(Equal([]byte("value1")))
			state, _ = ledgerPtr.GetState("chaincode2", "key2", false)
			Expect(state).To(Equal([]byte("value2")))
			state, _ = ledgerPtr.GetState("chaincode3", "key3", false)
			Expect(state).To(Equal([]byte("value3")))
		})
		It("should not return committed state", func() {
			state, _ := ledgerPtr.GetState("chaincode1", "key1", true)
			Expect(state).To(BeNil())
			state, _ = ledgerPtr.GetState("chaincode2", "key2", true)
			Expect(state).To(BeNil())
			state, _ = ledgerPtr.GetState("chaincode3", "key3", true)
			Expect(state).To(BeNil())
		})
		It("should successfully rollback the batch", func() {
			Expect(ledgerPtr.RollbackTxBatch(1)).To(BeNil())
			state, _ := ledgerPtr.GetState("chaincode1", "key1", false)
			Expect(state).To(BeNil())
			state, _ = ledgerPtr.GetState("chaincode2", "key2", false)
			Expect(state).To(BeNil())
			state, _ = ledgerPtr.GetState("chaincode3", "key3", false)
			Expect(state).To(BeNil())
			state, _ = ledgerPtr.GetState("chaincode1", "key1", true)
			Expect(state).To(BeNil())
			state, _ = ledgerPtr.GetState("chaincode2", "key2", true)
			Expect(state).To(BeNil())
			state, _ = ledgerPtr.GetState("chaincode3", "key3", true)
			Expect(state).To(BeNil())
		})
		It("should commit the batch with the correct ID", func() {
			uuid := util.GenerateUUID()