以太坊私有链运行智能合约,结构体输出不正确
发布于 15 天前 作者 francescopj 131 次浏览 来自 以太坊

我的智能合约在testrpc上测试能返回正确结果,但在私有链上输入test.AddLine('0x1','0x1',100,{from:eth.accounts[0])后,开启挖矿,输入test.GetLine.call(0),输出仍然为["0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", 0, 0, 0, 0, 0, false]。请问可能是什么原因?

	struct line
	{
		address countryA;
		address countryB;
		int MaxP;
		int P;
		int PriceA;
		int PriceB;
		uint Iter;
		bool done;
	}
	line[] public HVDC;
	uint LineNumber = 0;	
	function AddLine(address A, address B, int P) {
		HVDC.push(line({
			countryA: A,
			countryB: B,
			MaxP: P,
			P: 0,
			PriceA: 0,
			PriceB: 0,
			Iter: 0,
			done: false
		}));
		LineNumber++;
	}
		function CheckLine(uint i) returns(address _A, address _B, int _MaxP, int _P, int _PriceA, int _PriceB, uint _Iter, bool _done){
		_A = HVDC[i].countryA;
		_B = HVDC[i].countryB;
		_MaxP = HVDC[i].MaxP;
		_P = HVDC[i].P;
		_PriceA = HVDC[i].PriceA;
		_PriceB = HVDC[i].PriceB;
		_Iter = HVDC[i].Iter;
		_done = HVDC[i].done;
	}
	```
回到顶部