forked from tronprotocol/java-tron
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTxInputUtilTest.java
More file actions
44 lines (39 loc) · 1.71 KB
/
TxInputUtilTest.java
File metadata and controls
44 lines (39 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* java-tron is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* java-tron is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.tron.core;
import lombok.extern.slf4j.Slf4j;
import org.junit.Assert;
import org.junit.Test;
import org.tron.common.utils.ByteArray;
import org.tron.core.capsule.utils.TxInputUtil;
import org.tron.protos.Protocol.TXInput;
@Slf4j
public class TxInputUtilTest {
@Test
public void testNewTxInput() {
byte[] txId = ByteArray
.fromHexString("2c0937534dd1b3832d05d865e8e6f2bf23218300b33a992740d45ccab7d4f519");
long vout = 777L;
byte[] signature = ByteArray
.fromHexString("ded9c2181fd7ea468a7a7b1475defe90bb0fc0ca8d0f2096b0617465cea6568c");
byte[] pubkey = ByteArray
.fromHexString("a0c9d5524c055381fe8b1950e0c3b09d252add57a7aec061ae258aa03ee25822");
TXInput txInput = TxInputUtil.newTxInput(txId, vout, signature, pubkey);
Assert.assertArrayEquals(txId, txInput.getRawData().getTxID().toByteArray());
Assert.assertEquals(vout, txInput.getRawData().getVout());
Assert.assertArrayEquals(signature, txInput.getSignature().toByteArray());
Assert.assertArrayEquals(pubkey, txInput.getRawData().getPubKey().toByteArray());
}
}