Skip to content

Commit

Permalink
add lockHeight
Browse files Browse the repository at this point in the history
  • Loading branch information
Xboc committed Jan 6, 2021
1 parent 526684e commit db61b98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,15 @@ public BaseActionBean getPledgeSignData(long Height){
return mMakeAction.createAction(String.valueOf(Height));
}


public BaseActionBean getPledgeSignData(long Height,long lockHeight){
final long pledgeCoin=Long.valueOf(String.valueOf(sumCoinList(this.coinLis)));
this.outList=new ArrayList<>();
this.outList.add(new OutBean(pledgeCoin,mAccountBean.getAddressNoPrefix()));
//根据coin数量计算锁定高度
// long lockHeight=(30*(int)Math.floor(pledgeCoin/Long.valueOf(BASE_NUMBER)))+Long.valueOf(String.valueOf(Height));
MakeAction mMakeAction = new MakeAction(mAccountBean,TYPE_1_FOR_TRANSFER,coinLis,outList,lockHeight);
return mMakeAction.createAction(String.valueOf(Height));
}
/**
* 合并零钱或拆额零钱
* @param excreteCoin
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/onlychain/ocsignsdk/AboutSign.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static void main(String[] args) {

//————————————————————————————————————————————————————————————————————————————————————————————————————————————
//初始化IP配置
String ip="http://39.98.135.66:9082";
String ip="http://39.98.135.61:9082";
ApiConfig.init(ip);

//模拟一个最新高度
Expand All @@ -62,7 +62,7 @@ public void fail(Exception e) {
};

//导入账户
AccountBean mAccountBean=WalletUtils.createAccount(OcMath.hexStringToByteArray("ea23e889d590a443831a785a398ce74179f09dece2fe5bfda41f795c50240c62"));
AccountBean mAccountBean=WalletUtils.createAccount(OcMath.hexStringToByteArray("e123e889d590a443831a785a398ce74179f09dece2fe5bfda41f795c50240c62"));
StartTranferLocal mStartTranferLocal= new StartTranferLocal(mAccountBean);

//TODO 生成单笔转账交易签名
Expand All @@ -81,7 +81,7 @@ public void fail(Exception e) {
System.out.println("多笔转账:"+moreTrans.getCommitData());

//TODO 单笔或多笔零钱质押签名
BaseActionBean mPledge = mStartTranferLocal.inputCoin(coinPurse).getPledgeSignData(height);
BaseActionBean mPledge = mStartTranferLocal.inputCoin(coinPurse).getPledgeSignData(1,1);
System.out.println("单笔或多笔零钱质押:"+mPledge.getCommitData());

//TODO 单笔或多笔零钱拆额与合并签名
Expand Down

0 comments on commit db61b98

Please sign in to comment.