proto ChaincodeId

This commit is contained in:
chen4w 2019-03-11 09:26:04 +08:00
commit 3ed83eb024
25 changed files with 3858 additions and 3844 deletions

View File

@ -1,6 +1,4 @@
<configuration DEBUG="true">
<turboFilter class="rep.log.trace.repTurboLogFilter"/>
<!--Tips: Appender configuration, more detail ~ https://logback.qos.ch/manual/appenders.html-->
<!-- Insert the current time formatted as "yyyyMMdd'T'HHmmss" under

View File

@ -17,7 +17,6 @@
package rep.app.conf
import java.io._
import rep.crypto.ECDSASign
/**

View File

@ -37,7 +37,6 @@ import rep.app.conf.SystemProfile
import com.typesafe.config.ConfigValueFactory
import java.util.List
import java.util.ArrayList
import rep.log.trace.RepLogHelp
import rep.log.trace.LogType
import org.slf4j.LoggerFactory

View File

@ -14,15 +14,20 @@
*
*/
package rep.crypto
package rep.crypto.cert
import java.security.{PrivateKey,PublicKey}
import java.security.cert.{ Certificate, CertificateFactory }
import java.security._
/**
* @author c4w
* 系统签名相关提交给外部的接口第三方使用不需要直接调用该类
* @author jiangbuyun
* @version 1.0
*/
trait SignFunc {
trait ISigner {
def sign(privateKey: PrivateKey, message: Array[Byte]): Array[Byte]
def verify(signature: Array[Byte], message: Array[Byte], publicKey: PublicKey): Boolean
def getCertWithCheck(certAddr:String,certKey:String,sysTag:String):Option[java.security.cert.Certificate]
def CertificateIsValid(date:java.util.Date, cert:Certificate):Boolean
}

View File

@ -0,0 +1,86 @@
/*
* Copyright 2018 Blockchain Technology and Application Joint Lab, Linkel Technology Co., Ltd, Beijing, Fintech Research Center of ISCAS.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BA SIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package rep.crypto.cert
import java.security._
import java.io._
import java.security.cert.{ Certificate, CertificateFactory }
import rep.app.conf.SystemProfile
import com.google.protobuf.ByteString
import fastparse.utils.Base64
import rep.utils.SerializeUtils
import rep.storage._
import scala.collection.mutable
import com.fasterxml.jackson.core.Base64Variants
import java.security.cert.X509Certificate
import javax.xml.bind.DatatypeConverter
import java.util.ArrayList
import java.util.List
import sun.security.ec.ECPublicKeyImpl
/**
* 实现系统签名和验签功能第三方使用不需要直接调用该类
* @author jiangbuyun
* @version 1.0
*/
class ImpECDSASigner extends ISigner {
private val alg = "SHA1withECDSA"
override def sign(privateKey: PrivateKey, message: Array[Byte]): Array[Byte] = {
if(privateKey == null) throw new RuntimeException("签名时私钥为空!")
val s1 = Signature.getInstance(alg);
s1.initSign(privateKey)
s1.update(message)
s1.sign()
}
override def verify(signature: Array[Byte], message: Array[Byte], publicKey: PublicKey): Boolean = {
if(publicKey == null) throw new RuntimeException("验证签名时公钥为空!")
val s2 = Signature.getInstance(alg);
s2.initVerify(publicKey)
s2.update(message)
s2.verify(signature)
}
override def CertificateIsValid(date:java.util.Date, cert:Certificate):Boolean={
var isValid :Boolean = false
var start = System.currentTimeMillis()
try {
if(cert == null){
isValid = false
}else{
if(SystemProfile.getCheckCertValidate == 0){
isValid = true
}else if(SystemProfile.getCheckCertValidate == 1){
if(cert.isInstanceOf[X509Certificate]){
var x509cert :X509Certificate = cert.asInstanceOf[X509Certificate]
x509cert.checkValidity(date)
isValid = true
}
}else{
isValid = true
}
}
} catch{
case e : Exception => isValid = false
}
var end = System.currentTimeMillis()
//println("check cert validate,spent time="+(end-start))
isValid;
}
}

View File

@ -0,0 +1,145 @@
/*
* Copyright 2018 Blockchain Technology and Application Joint Lab, Linkel Technology Co., Ltd, Beijing, Fintech Research Center of ISCAS.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BA SIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package rep.crypto.cert
import java.security.{ PrivateKey, PublicKey, KeyStore }
import java.security.cert.{ Certificate, CertificateFactory }
import rep.protos.peer.CertId
import scala.collection.mutable
import java.io._
import java.util.{ ArrayList, List }
/**
* 负责签名和验签的工具了所有相关的功能都调用该类
* @author jiangbuyun
* @version 1.0
*/
object SignTool {
private var signer: ISigner = null
private var SignType: String = "ECDSA"
private var key_password = mutable.HashMap[String, String]()
private var keyStore = mutable.HashMap[String, KeyStore]()
private var PublickeyCerts = mutable.HashMap[String, Certificate]()
synchronized {
if (this.signer == null) {
signer = new ImpECDSASigner()
}
}
private def getPrivateKey(alias: String): PrivateKey = {
val sk = keyStore(alias).getKey(alias, key_password(alias).toCharArray)
sk.asInstanceOf[PrivateKey]
}
private def getPrivateKey(certinfo: CertId): PrivateKey = {
//todo
null
}
//根据CertId实现签名
def sign(certinfo: CertId, message: Array[Byte]): Array[Byte] = {
val key = certinfo.creditCode + "_" + certinfo.certName
var pk: PrivateKey = null
if (this.keyStore.contains(key)) {
pk = getPrivateKey(key)
} else {
pk = getPrivateKey(certinfo)
}
this.signer.sign(pk, message)
}
//根据私钥实现签名
def sign(privateKey: PrivateKey, message: Array[Byte]): Array[Byte] = {
this.signer.sign(privateKey, message)
}
private def getPublicKeyByName(alias: String): PublicKey = {
var tmpcert = PublickeyCerts.get(alias)
if (tmpcert == null && tmpcert != None) {
throw new RuntimeException("证书不存在")
}
if (this.signer.CertificateIsValid(new java.util.Date(), tmpcert.get)) {
tmpcert.get.getPublicKey
} else {
null
}
}
private def getPublicKeyByName(certinfo: CertId): PublicKey = {
//todo
null
}
//根据CertId实现验签
def verify(signature: Array[Byte], message: Array[Byte], certinfo: CertId): Boolean = {
val key = certinfo.creditCode + "_" + certinfo.certName
var pubkey: PublicKey = null
pubkey = getPublicKeyByName(key)
if (pubkey == null) {
pubkey = getPublicKeyByName(certinfo)
}
this.signer.verify(signature, message, pubkey)
}
//根据公钥实现签名
def verify(signature: Array[Byte], message: Array[Byte], publicKey: PublicKey): Boolean = {
this.signer.verify(signature, message, publicKey)
}
//节点启动时需要调用该函数初始化节点私钥
def InitNodePrivateKey(alias: String, password: String, path: String) = {
synchronized {
key_password(alias + "_1") = password
val fis = new FileInputStream(new File(path))
val pwd = password.toCharArray()
if (keyStore.contains(alias)) {
keyStore(alias).load(fis, pwd)
} else {
val pkeys = KeyStore.getInstance(KeyStore.getDefaultType)
pkeys.load(fis, pwd)
keyStore(alias + "_1") = pkeys
}
}
}
//节点启动时需要调用该函数初始化节点公钥
def InitNodePublicKey(password: String, path: String) = {
synchronized {
val fis = new FileInputStream(new File(path))
val pwd = password.toCharArray()
var trustKeyStore = KeyStore.getInstance(KeyStore.getDefaultType)
trustKeyStore.load(fis, pwd)
val enums = trustKeyStore.aliases()
while (enums.hasMoreElements) {
val alias = enums.nextElement()
val cert = trustKeyStore.getCertificate(alias)
PublickeyCerts.put(alias + "_1", cert)
}
}
}
//提供给共识获取证书列表
def getAliasOfTrustkey: List[String] = {
var list: List[String] = new ArrayList[String]
val enums = PublickeyCerts.iterator
while (enums.hasNext) {
val alias = enums.next()
list.add(alias._1)
}
list
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright 2018 Blockchain Technology and Application Joint Lab, Linkel Technology Co., Ltd, Beijing, Fintech Research Center of ISCAS.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BA SIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package rep.log.trace
import java.util.concurrent.ConcurrentHashMap
import scala.collection.JavaConverters._
import rep.log.trace.ModuleType.ModuleType;
object LogOption {
private implicit var options = new ConcurrentHashMap[String, Boolean] asScala
def isPrintLog(nodeName:String,mt:ModuleType):Boolean={
var b = true
if(options.contains(nodeName)){
if(options(nodeName)){
val k = nodeName+"_"+mt.toString()
if(options.contains(k)){
b = options(k)
}
}else{
b = false
}
}
b
}
def openNodeLog(nodeName:String)={
options.put(nodeName, true)
}
def closeNodeLog(nodeName:String)={
options.put(nodeName, false)
}
def setModuleLogOption(nodeName:String,option:String,isOpen:Boolean)={
options.put(nodeName+"_"+option, isOpen)
}
}

View File

@ -1,146 +0,0 @@
/*
* Copyright 2018 Blockchain Technology and Application Joint Lab, Linkel Technology Co., Ltd, Beijing, Fintech Research Center of ISCAS.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BA SIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package rep.log.trace;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.StringTokenizer;
public class LogTraceOption {
private static LogTraceOption traceOptionObj = null;
private ConcurrentHashMap<String,Boolean> lhm = null;
private ConcurrentHashMap<String,Boolean> nodeLog = null;
private AtomicBoolean isOpen = null;
private LogTraceOption() {
this.lhm = new ConcurrentHashMap<String,Boolean>();
this.nodeLog = new ConcurrentHashMap<String,Boolean>();
this.isOpen = new AtomicBoolean(true);
}
public static synchronized LogTraceOption getLogTraceOption() {
if(traceOptionObj == null) {
traceOptionObj = new LogTraceOption();
}
return traceOptionObj;
}
public void addLogOption(String packageName,Boolean status) {
lhm.put(packageName, status);
}
public void addNodeLogOption(String nodeName,Boolean status) {
nodeLog.put(nodeName, status);
}
public boolean isOpenOutputLog(String nodeName,String packageName) {
boolean rb = true;
if(this.isOpen.get()) {
if(nodeName != null) {
if(isNodeClose(nodeName)) {
rb = isClose(packageName);
}else {
rb = false;
}
}else {
rb = isClose(packageName);
}
}else {
rb = false;
}
return rb;
}
private boolean isNodeClose(String nodeNme) {
boolean isclose = true;
if(this.nodeLog.isEmpty()) {
return isclose;
}else {
if(!this.nodeLog.containsKey(nodeNme)) {
return isclose;
}else {
Boolean b = this.nodeLog.get(nodeNme);
isclose = b.booleanValue();
return isclose;
}
}
}
private boolean isClose(String packageName) {
boolean isclose = true;
if(this.lhm.isEmpty()) {
return isclose;
}else {
String pn = packageName;
while(!pn.equalsIgnoreCase("")) {
if(!this.lhm.containsKey(pn)) {
pn = getParent(pn);
}else {
Boolean b = this.lhm.get(pn);
isclose = b.booleanValue();
break;
}
}
return isclose;
}
}
/*private boolean getValueForName(String packageName) {
if(!this.lhm.containsKey(packageName)) {
return false;
}else {
Boolean b = this.lhm.get(packageName);
return b.booleanValue();
}
}*/
private String getParent(String name) {
String rs = "";
StringTokenizer st = new StringTokenizer(name,".",false);
if(st.countTokens() == 1) {
return rs;
}else {
int len = st.countTokens() - 1;
for(int i = 0; i < len; i++) {
if(i == 0) {
rs = rs + st.nextToken();
}else {
rs = rs + "."+st.nextToken();
}
}
}
return rs;
}
public void CloseAll() {
this.isOpen.set(false);
}
public void OpenAll() {
this.isOpen.set(true);
}
}

View File

@ -13,20 +13,18 @@
* limitations under the License.
*
*/
package rep.storage
package rep.log.trace
/**
* @author c4w
* 定义日志的类型
* @author jiangbuyun
* @version 1.0
*/
trait Storage[Key, Value] {
def set(key: Key, value: Value): Unit
def get(key: Key): Option[Value]
def containsKey(key: Key): Boolean = get(key).isDefined
def commit(): Unit
def merkle():Array[Byte]
object LogType extends Enumeration{
type LogType = Value
val INFO = Value(1)
val WARN = Value(2)
val DEBUG = Value(3)
val ERROR = Value(4)
}

View File

@ -13,9 +13,23 @@
* limitations under the License.
*
*/
package rep.log.trace
package rep.log.trace;
/**
* 定义输出日志的模块
* @author jiangbuyun
* @version 1.0
*/
public enum LogType {
INFO,DEBUG,WARN,ERROR
object ModuleType extends Enumeration{
type ModuleType = Value
val blocker = Value("blocker")
val endorser = Value("endorser")
val timeTracer = Value("timeTracer")
val storager = Value("storager")
val preloadTrans = Value("preloadTrans")
val contract = Value("contract")
val others = Value("others")
def checkExists(t:String) = this.values.exists(_.toString==t)
}

View File

@ -1,58 +0,0 @@
/*
* Copyright 2018 Blockchain Technology and Application Joint Lab, Linkel Technology Co., Ltd, Beijing, Fintech Research Center of ISCAS.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BA SIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package rep.log.trace
import org.slf4j.LoggerFactory
import org.slf4j.Logger;
object RepLogHelp {
case object LOG_TYPE{
val INFO = 1
val DEBUG =2
val WARN = 3
val ERROR = 4
}
def logMsg(log: Logger,lOG_TYPE: LogType, msg:String, nodeName:String) = {
lOG_TYPE match {
case LogType.INFO =>
log.info(msg,Array(nodeName))
case LogType.DEBUG =>
log.debug(msg,Array(nodeName))
case LogType.WARN =>
log.warn(msg,Array(nodeName))
case LogType.ERROR =>
log.error(msg,Array(nodeName))
}
}
def logMsg(log: Logger,lOG_TYPE: LogType, msg:String) = {
lOG_TYPE match {
case LogType.INFO =>
log.info(msg)
case LogType.DEBUG =>
log.debug(msg)
case LogType.WARN =>
log.warn(msg)
case LogType.ERROR =>
log.error(msg)
}
}
}

View File

@ -0,0 +1,72 @@
/*
* Copyright 2018 Blockchain Technology and Application Joint Lab, Linkel Technology Co., Ltd, Beijing, Fintech Research Center of ISCAS.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BA SIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package rep.log.trace
import org.slf4j.LoggerFactory
import org.slf4j.Logger;
import rep.log.trace.ModuleType.ModuleType
import rep.log.trace.LogType.LogType
/**
* RepChain统一日志输出工具外部输出日志统一调用对象
* @author jiangbuyun
* @version 1.0
*/
object RepLogger {
protected def log = LoggerFactory.getLogger(this.getClass)
def logWarn(nodeName:String,mtype:ModuleType,message:String) = {
if(LogOption.isPrintLog(nodeName, mtype)){
logMsg(LogType.WARN,getMessage(nodeName,mtype,message) )
}
}
def logDebug(nodeName:String,mtype:ModuleType,message:String) = {
if(LogOption.isPrintLog(nodeName, mtype)){
logMsg(LogType.DEBUG,getMessage(nodeName,mtype,message) )
}
}
def logInfo(nodeName:String,mtype:ModuleType,message:String) = {
if(LogOption.isPrintLog(nodeName, mtype)){
logMsg(LogType.INFO,getMessage(nodeName,mtype,message) )
}
}
def logError(nodeName:String,mtype:ModuleType,message:String) = {
if(LogOption.isPrintLog(nodeName, mtype)){
logMsg(LogType.ERROR,getMessage(nodeName,mtype,message))
}
}
private def getMessage(nodeName:String,mtype:ModuleType,message:String):String={
nodeName + " ~ " +mtype.toString() + " ~ " + message
}
private def logMsg(logtype: LogType.LogType, msg:String) = {
logtype match {
case LogType.INFO =>
log.info(msg)
case LogType.DEBUG =>
log.debug(msg)
case LogType.WARN =>
log.warn(msg)
case LogType.ERROR =>
log.error(msg)
}
}
}

View File

@ -1,64 +0,0 @@
/*
* Copyright 2018 Blockchain Technology and Application Joint Lab, Linkel Technology Co., Ltd, Beijing, Fintech Research Center of ISCAS.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BA SIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package rep.log.trace;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
public class RepTimeTrace {
private static RepTimeTrace timetrace = null;
private ConcurrentHashMap<String,TimePair> nodeTimeTracer = null;
private AtomicBoolean isOpenTimeTrace = null;
private RepTimeTrace() {
this.nodeTimeTracer = new ConcurrentHashMap<String,TimePair>();
this.isOpenTimeTrace = new AtomicBoolean(false);
}
public static synchronized RepTimeTrace getRepTimeTrace() {
if(timetrace == null) {
timetrace = new RepTimeTrace();
}
return timetrace;
}
public void addTimeTrace(String nodeName,String timetag,long time,boolean isstart) {
if(this.isOpenTimeTrace.get()) {
TimePair rtd = null;
if(this.nodeTimeTracer.containsKey(nodeName+"_"+timetag)) {
rtd = this.nodeTimeTracer.get(nodeName+"_"+timetag);
}else {
rtd = new TimePair(nodeName+"_"+timetag,nodeName);
this.nodeTimeTracer.put(nodeName+"_"+timetag,rtd);
}
if(isstart) {
rtd.start(time);
}else {
rtd.finish(time);
}
}
}
public void openTimeTrace() {
this.isOpenTimeTrace.set(true);
}
public void closeTimeTrace() {
this.isOpenTimeTrace.set(false);
}
}

View File

@ -13,28 +13,31 @@
* limitations under the License.
*
*/
package rep.log.trace
package rep.log;
import java.util.concurrent.ConcurrentHashMap
import scala.collection.JavaConverters._
/**
* Created by User on 2017/7/23.
*/
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply;
/**
* log过滤类实现
* @author shidianyue
* RepChain系统运行时间跟踪工具需要跟踪运行时间的程序统一调用该对象
* @author jiangbuyun
* @version 1.0
* */
public class LogFilterExp extends Filter<ILoggingEvent> {
*/
@Override
public FilterReply decide(ILoggingEvent event) {
if (event.getMessage().contains("Opt Time")) {
return FilterReply.ACCEPT;
} else {
return FilterReply.DENY;
object RepTimeTracer {
private implicit var times = new ConcurrentHashMap[String, Long] asScala
def setStartTime(nodeName:String,flag:String,t:Long)={
this.times.put(nodeName+"-"+flag, t);
}
def setEndTime(nodeName:String,flag:String,t:Long)={
val key = nodeName+"-"+flag;
if(this.times.contains(key)) {
val tl = t - this.times(key);
RepLogger.logInfo(nodeName, ModuleType.timeTracer, key+"="+tl)
}
}
}

View File

@ -1,56 +0,0 @@
/*
* Copyright 2018 Blockchain Technology and Application Joint Lab, Linkel Technology Co., Ltd, Beijing, Fintech Research Center of ISCAS.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BA SIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package rep.log.trace;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
public class TimePair {
private static Logger log = LoggerFactory.getLogger(TimePair.class);
private String timeTag = "";
private String nodeName = "";
private long start = 0l;
private long end = 0;
public TimePair(String timeTag,String nodeName) {
this.timeTag = timeTag;
this.nodeName = nodeName;
}
public void start(long start) {
this.start = start;
this.end = 0l;
}
public synchronized void finish(long end) {
this.end = end;
String str = this.toString();
//if(nodeName.equalsIgnoreCase("1")) {
log.info(str);
System.out.println(str);
//}
this.start = 0l;
this.end = 0l;
}
public String toString() {
if(this.start > 0 && this.end > 0)
return "~"+"timeTag="+this.timeTag+"~"+"start="+(this.start)+"~"+"end="+this.end+"~"+"timespan="+(this.end-this.start);
else
return "~"+"timeTag="+this.timeTag+"~"+" not enough time item";
}
}

View File

@ -1,69 +0,0 @@
/*
* Copyright 2018 Blockchain Technology and Application Joint Lab, Linkel Technology Co., Ltd, Beijing, Fintech Research Center of ISCAS.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BA SIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package rep.log.trace;
import org.slf4j.Marker;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.turbo.TurboFilter;
import ch.qos.logback.core.spi.FilterReply;
import rep.log.trace.LogTraceOption;
public class repTurboLogFilter extends TurboFilter {
private LogTraceOption logOption = LogTraceOption.getLogTraceOption();
@Override
public FilterReply decide(Marker marker, Logger logger, Level level,
String format, Object[] params, Throwable t) {
if (!isStarted()) {
return FilterReply.NEUTRAL;
}
if(params != null && params.length > 0) {
Object sysname = params[0];
if(sysname != null) {
String nameobj = null;
if(sysname instanceof String[]) {
nameobj = ((String[])sysname)[0];
}
if(logOption.isOpenOutputLog(nameobj,logger.getName())) {
return FilterReply.ACCEPT;
}else {
return FilterReply.DENY;
}
}else {
if(logOption.isOpenOutputLog(null,logger.getName())) {
return FilterReply.ACCEPT;
}else {
return FilterReply.DENY;
}
}
}else {
if(logOption.isOpenOutputLog(null,logger.getName())) {
return FilterReply.ACCEPT;
}else {
return FilterReply.DENY;
}
}
}
@Override
public void start() {
super.start();
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright 2018 Blockchain Technology and Application Joint Lab, Linkel Technology Co., Ltd, Beijing, Fintech Research Center of ISCAS.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BA SIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package rep.log.trace
import rep.log.trace.ModuleType.ModuleType
/**
* 日志模块的测试代码
* @author jiangbuyun
* @version 1.0
*/
object test extends Object{
def main(args: Array[String]): Unit = {
var i = 0
while(i < 100){
RepLogger.logInfo("1", ModuleType.endorser, s"test{$i}")
if(i == 10){
LogOption.closeNodeLog("1")
}
if(i == 20){
LogOption.openNodeLog("1")
LogOption.setModuleLogOption("1", "endorser", false)
}
if(i == 30){
LogOption.setModuleLogOption("1", "endorser", true)
}
if(i == 35){
RepTimeTracer.setStartTime("1", "test", System.currentTimeMillis())
}
if(i == 37){
RepTimeTracer.setEndTime("1", "test", System.currentTimeMillis())
}
i = i+1
}
}
}

View File

@ -1,52 +0,0 @@
/*
* Copyright 2018 Blockchain Technology and Application Joint Lab, Linkel Technology Co., Ltd, Beijing, Fintech Research Center of ISCAS.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BA SIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package rep.storage
import rep.protos._
import rep.log.trace.RepLogHelp
import rep.log.trace.LogType
import org.slf4j.LoggerFactory
/**
* @author c4w
*/
class FakeStorage() extends Storage[String,Array[Byte]] {
import FakeStorage._
protected def log = LoggerFactory.getLogger(this.getClass)
private val m = scala.collection.mutable.Map[Key,Value]()
override def set(key:Key, value:Value): Unit = {
val me = this
log.info(s"set state:$key $value $me")
m.put(key,value)
}
override def get(key:Key): Option[Value] = {
m.get(key)
}
override def commit(): Unit={
}
override def merkle():Array[Byte]={
null
}
}
object FakeStorage {
type Key = String
type Value = Array[Byte]
}

View File

@ -32,6 +32,7 @@ import rep.storage.merkle._
import rep.storage.util.StoreUtil
import com.google.protobuf.ByteString
import rep.crypto._
import rep.log.trace._
/**
* @author jiangbuyun
@ -39,7 +40,7 @@ import rep.crypto._
* @since 2017-09-28
* @category 该类实现LevelDB数据库的操作并且添加外部操作定义
* */
abstract class IDataAccess(val SystemName:String) extends AbstractLevelDB{
abstract class IDataAccess(val SystemName:String) extends AbstractLevelDB(SystemName:String){
private var DBDataPath :String = ""
private var opts : Options = null
private var leveldbfactory : JniDBFactory = JniDBFactory.factory
@ -49,14 +50,14 @@ abstract class IDataAccess(val SystemName:String) extends AbstractLevelDB{
private var batch : WriteBatch = null
if(SystemName == null || SystemName.equalsIgnoreCase("")){
log.info("SystemName="+SystemName)
RepLogger.logInfo(SystemName, ModuleType.storager, "SystemName="+SystemName)
}
val sc : StoreConfig = StoreConfig.getStoreConfig()
DBDataPath = sc.getDbPath(SystemName)
val b = pathUtil.MkdirAll(this.DBDataPath)
if(!b){
log.error("IDataAccess_"+ SystemName + "_" +"DBOP Create error,db store dir is null!")
RepLogger.logError(SystemName, ModuleType.storager, "IDataAccess_"+ SystemName + "_" +"DBOP Create error,db store dir is null!")
throw new Exception("db store dir is null! "+DBDataPath)
}
@ -120,7 +121,8 @@ abstract class IDataAccess(val SystemName:String) extends AbstractLevelDB{
this.batch.close()
}catch{
case e:Exception =>{
log.error("IDataAccess_" + SystemName + "_" + s"DBOP BeginTrans failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
"IDataAccess_" + SystemName + "_" + s"DBOP BeginTrans failed, error info= "+e.getMessage)
throw e
}
}finally{
@ -136,7 +138,8 @@ abstract class IDataAccess(val SystemName:String) extends AbstractLevelDB{
case e:Exception =>{
this.IsTrans = false
this.batch = null
log.error("IDataAccess_" + SystemName + "_" + s"DBOP BeginTrans failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
"IDataAccess_" + SystemName + "_" + s"DBOP BeginTrans failed, error info= "+e.getMessage)
throw e
}
}
@ -165,7 +168,8 @@ abstract class IDataAccess(val SystemName:String) extends AbstractLevelDB{
}
}catch{
case e:Exception =>{
log.error("IDataAccess_" + SystemName + "_" + s"DBOP CommitTrans failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
"IDataAccess_" + SystemName + "_" + s"DBOP CommitTrans failed, error info= "+e.getMessage)
throw e
}
}
@ -189,7 +193,8 @@ abstract class IDataAccess(val SystemName:String) extends AbstractLevelDB{
}
}catch{
case e:Exception =>{
log.error("IDataAccess_" + SystemName + "_" + s"DBOP CommitTrans failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
"IDataAccess_" + SystemName + "_" + s"DBOP CommitTrans failed, error info= "+e.getMessage)
throw e
}
}finally{
@ -201,7 +206,8 @@ abstract class IDataAccess(val SystemName:String) extends AbstractLevelDB{
}
}catch{
case e:Exception =>{
log.warn("IDataAccess_" + SystemName + "_" + s"DBOP CommitTrans failed, error info= "+e.getMessage)
RepLogger.logWarn(SystemName, ModuleType.storager,
"IDataAccess_" + SystemName + "_" + s"DBOP CommitTrans failed, error info= "+e.getMessage)
}
}finally{
this.batch = null
@ -228,7 +234,8 @@ abstract class IDataAccess(val SystemName:String) extends AbstractLevelDB{
}
}catch{
case e:Exception =>{
log.error("IDataAccess_" + SystemName + "_" + s"DBOP RollbackTrans failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
"IDataAccess_" + SystemName + "_" + s"DBOP RollbackTrans failed, error info= "+e.getMessage)
throw e
}
}finally{
@ -254,7 +261,8 @@ abstract class IDataAccess(val SystemName:String) extends AbstractLevelDB{
}catch{
case e:Exception =>{
rb = null
log.error("IDataAccess_" + SystemName + "_" + s"DBOP Get failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
"IDataAccess_" + SystemName + "_" + s"DBOP Get failed, error info= "+e.getMessage)
throw e
}
}
@ -290,7 +298,8 @@ abstract class IDataAccess(val SystemName:String) extends AbstractLevelDB{
}catch{
case e:Exception =>{
b = false
log.error("IDataAccess_" + SystemName + "_" + s"DBOP Put failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
"IDataAccess_" + SystemName + "_" + s"DBOP Put failed, error info= "+e.getMessage)
throw e
}
}
@ -371,7 +380,8 @@ abstract class IDataAccess(val SystemName:String) extends AbstractLevelDB{
}
}catch{
case e:Exception =>{
log.error("IDataAccess_" + SystemName + "_" + s"DBOP FindByLike failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
"IDataAccess_" + SystemName + "_" + s"DBOP FindByLike failed, error info= "+e.getMessage)
throw e
}
}finally{
@ -380,7 +390,8 @@ abstract class IDataAccess(val SystemName:String) extends AbstractLevelDB{
iterator.close()
}catch{
case e:Exception =>{
log.error("IDataAccess_" + SystemName + "_" + s"DBOP FindByLike failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
"IDataAccess_" + SystemName + "_" + s"DBOP FindByLike failed, error info= "+e.getMessage)
}
}
}

View File

@ -33,6 +33,7 @@ import java.io._
import rep.storage.merkle._
import rep.protos.peer.OperLog
import scala.collection.mutable._
import rep.log.trace._
/**
* @author jiangbuyun
@ -65,7 +66,8 @@ class ImpDataAccess private(SystemName:String) extends IDataAccess(SystemName){
rb = getBlockByHash(bh)
}catch{
case e:Exception =>{
log.info("base64 is invalidate")
RepLogger.logError(SystemName, ModuleType.storager,
"base64 is invalidate")
}
}
}
@ -421,8 +423,9 @@ class ImpDataAccess private(SystemName:String) extends IDataAccess(SystemName){
var trans = block.transactions
if(trans.length > 0){
trans.foreach(f=>{
if(f.txid.equals(txid)){
rel = f.getPayload.getChaincodeID.name
if(f.id.equals(txid)){
//rel = f.getPayload.getChaincodeID.name
rel = this.getCid(f.cid.get)
//rel = f.chaincodeID.toStringUtf8()
}
})
@ -442,7 +445,7 @@ class ImpDataAccess private(SystemName:String) extends IDataAccess(SystemName){
override def restoreBlock(block:Block):Boolean={
var b : Boolean = false
if(block == null) return b
if(block.stateHash == null) return b
if(block.operHash == null) return b
synchronized{
val oldh = getBlockHeight()
val oldno = this.getMaxFileNo()
@ -457,9 +460,9 @@ class ImpDataAccess private(SystemName:String) extends IDataAccess(SystemName){
if(isLastBlock(block,prevblock)){
val txresults = block.getNonHashData.transactionResults
val txresults = block.transactionResults
txresults.foreach(f=>{
list += f.txid -> f.ol.seq
list += f.txId -> f.ol.seq
}
)
try{
@ -531,14 +534,16 @@ class ImpDataAccess private(SystemName:String) extends IDataAccess(SystemName){
var b : Boolean = false
var block = _block
if(block == null) return b
if(block.stateHash == null) return b
if(block.operHash == null) return b
if(block.previousBlockHash == null) return b
this.log.info("system_name="+this.SystemName+"\t store a block")
RepLogger.logInfo(SystemName, ModuleType.storager,
"system_name="+this.SystemName+"\t store a block")
synchronized{
val oldh = getBlockHeight()
val oldno = this.getMaxFileNo()
val oldtxnumber = this.getBlockAllTxNumber()
this.log.info("system_name="+this.SystemName+"\t old height="+oldh+"\t old file no="+oldno+"\t old tx number="+oldtxnumber)
RepLogger.logInfo(SystemName, ModuleType.storager,
"system_name="+this.SystemName+"\t old height="+oldh+"\t old file no="+oldno+"\t old tx number="+oldtxnumber)
//检查要保存的块的上一块是否是当前块
var prevblock : Block = null
if(oldh > 0){
@ -575,11 +580,13 @@ class ImpDataAccess private(SystemName:String) extends IDataAccess(SystemName){
bidx.setBlockFilePos(startpos+8)
bidx.setBlockLength(blenght)
this.log.info("system_name="+this.SystemName+"\t new height="+newh+"\t new file no="+newno+"\t new tx number="+newtxnumber)
RepLogger.logInfo(SystemName, ModuleType.storager,
"system_name="+this.SystemName+"\t new height="+newh+"\t new file no="+newno+"\t new tx number="+newtxnumber)
this.Put(IdxPrefix.IdxBlockPrefix+bidx.getBlockHash(), bidx.toArrayByte())
this.log.info("system_name="+this.SystemName+"\t blockhash="+bidx.getBlockHash())
RepLogger.logInfo(SystemName, ModuleType.storager,
"system_name="+this.SystemName+"\t blockhash="+bidx.getBlockHash())
this.Put(IdxPrefix.IdxBlockHeight+newh, bidx.getBlockHash().getBytes())
@ -596,7 +603,8 @@ class ImpDataAccess private(SystemName:String) extends IDataAccess(SystemName){
bhelp.writeBlock(bidx.getBlockFileNo(), bidx.getBlockFilePos()-8, BlockHelp.longToByte(blenght)++rbb)
b = true
this.log.info("system_name="+this.SystemName+"\t blockhash="+bidx.getBlockHash()+"\tcommited success")
RepLogger.logInfo(SystemName, ModuleType.storager,
"system_name="+this.SystemName+"\t blockhash="+bidx.getBlockHash()+"\tcommited success")
}catch{
case e:Exception =>{
this.setBlockHeight(oldh)
@ -625,7 +633,7 @@ class ImpDataAccess private(SystemName:String) extends IDataAccess(SystemName){
private def commitAndAddBlock( block:Block,blockhsah:Array[Byte]):Boolean={
var b : Boolean = false
if(block == null) return b
if(block.stateHash == null) return b
if(block.operHash == null) return b
if(block.previousBlockHash == null) return b
if(blockhsah == null) return b
val rbb = block.toByteArray

View File

@ -23,6 +23,7 @@ import rep.storage.merkle._
import scala.collection.mutable.ArrayBuffer
import rep.protos.peer._;
import scala.util.control.Breaks
import rep.log.trace._
/**内存数据库的访问类,属于多实例。
* @constructor 根据SystemName和InstanceName建立实例
@ -33,7 +34,7 @@ import scala.util.control.Breaks
* @since 2017-09-28
* @category 内存数据库的访问类属于多实例
*/
class ImpDataPreload (SystemName:String,InstanceName:String) extends AbstractLevelDB {
class ImpDataPreload (SystemName:String,InstanceName:String) extends AbstractLevelDB(SystemName:String) {
private var update :java.util.concurrent.ConcurrentHashMap[String,Array[Byte]] = new java.util.concurrent.ConcurrentHashMap[String,Array[Byte]]
private var dbop = ImpDataAccess.GetDataAccess(SystemName)
@ -85,7 +86,8 @@ class ImpDataPreload (SystemName:String,InstanceName:String) extends AbstractLev
}catch{
case e:Exception =>{
rb = null
log.error("ImpDataPreload_" + SystemName + "_" + s"ImpDataPreload Get failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
"ImpDataPreload_" + SystemName + "_" + s"ImpDataPreload Get failed, error info= "+e.getMessage)
throw e
}
}
@ -104,10 +106,12 @@ class ImpDataPreload (SystemName:String,InstanceName:String) extends AbstractLev
var b : Boolean = true
try{
if(key == null){
log.info("ImpDataPreload_" + SystemName + "_" + s"ImpDataPreload Put failed, error info= key is null")
RepLogger.logInfo(SystemName, ModuleType.storager,
"ImpDataPreload_" + SystemName + "_" + s"ImpDataPreload Put failed, error info= key is null")
}
if(bb == null){
log.info("ImpDataPreload_" + SystemName + "_" + s"ImpDataPreload Put failed, error info= value is null")
RepLogger.logInfo(SystemName, ModuleType.storager,
"ImpDataPreload_" + SystemName + "_" + s"ImpDataPreload Put failed, error info= value is null")
}
if(key != null && bb != null){
if(this.update.get(key) != null){
@ -138,7 +142,8 @@ class ImpDataPreload (SystemName:String,InstanceName:String) extends AbstractLev
}catch{
case e:Exception =>{
b = false
log.error("ImpDataPreload_" + SystemName + "_" + s"ImpDataPreload Put failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
"ImpDataPreload_" + SystemName + "_" + s"ImpDataPreload Put failed, error info= "+e.getMessage)
throw e
}
}
@ -205,9 +210,10 @@ class ImpDataPreload (SystemName:String,InstanceName:String) extends AbstractLev
val loopbreak = new Breaks
loopbreak.breakable(
trans.foreach(f=>{
if(f.txid.equals(txid)){
val chainspec = f.payload.get
rel = chainspec.chaincodeID.get.name
if(f.id.equals(txid)){
rel = this.getCid(f.cid.get)
//val chainspec = f.payload.get
//rel = chainspec.chaincodeID.get.name
loopbreak.break
}
})
@ -228,13 +234,13 @@ class ImpDataPreload (SystemName:String,InstanceName:String) extends AbstractLev
def VerifyForEndorsement(block:Block):Boolean={
var b : Boolean = false
if(block == null) return b
if(block.stateHash == null) return b
if(block.operHash == null) return b
try{
var list : scala.collection.mutable.LinkedHashMap[String,Seq[OperLog]] = new scala.collection.mutable.LinkedHashMap[String,Seq[OperLog]]()
val txresults = block.getNonHashData.transactionResults
val txresults = block.transactionResults
txresults.foreach(f=>{
list += f.txid -> f.ol
list += f.txId -> f.ol
}
)
@ -252,13 +258,14 @@ class ImpDataPreload (SystemName:String,InstanceName:String) extends AbstractLev
}
})
}
val shash4block = block.stateHash.toStringUtf8
val shash4block = block.operHash.toStringUtf8
val shash4local = this.GetComputeMerkle4String
if(shash4block.equals(shash4local)){
b = true
}else{
b = false
this.log.error("system_name="+this.SystemName+"\t verify World State is failed, hash4block="+shash4block+"\t hash4local="+shash4local)
RepLogger.logError(SystemName, ModuleType.storager,
"system_name="+this.SystemName+"\t verify World State is failed, hash4block="+shash4block+"\t hash4local="+shash4local)
}
}catch{
case e:Exception =>{
@ -326,7 +333,8 @@ private class MultiDBMgr (val SystemName:String) {
}
}catch{
case e:Exception =>{
log.error("MultiDBMgr_" + SystemName + "_" + s"ImpDataPreload Create failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
"MultiDBMgr_" + SystemName + "_" + s"ImpDataPreload Create failed, error info= "+e.getMessage)
throw e
}
}
@ -359,7 +367,8 @@ private class MultiDBMgr (val SystemName:String) {
DBOps -= f
}catch{
case e:Exception =>{
log.error("MultiDBMgr_" + SystemName + "_" + s"ImpDataPreload clear failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
"MultiDBMgr_" + SystemName + "_" + s"ImpDataPreload clear failed, error info= "+e.getMessage)
throw e
}
}
@ -380,7 +389,8 @@ private class MultiDBMgr (val SystemName:String) {
DBOps -= InstanceName
}catch{
case e:Exception =>{
log.error("MultiDBMgr_" + SystemName + "_" + s"ImpDataPreload Free failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
"MultiDBMgr_" + SystemName + "_" + s"ImpDataPreload Free failed, error info= "+e.getMessage)
throw e
}
}
@ -422,7 +432,8 @@ object ImpDataPreloadMgr{
dbop = singleobj.GetImpDataPreload(InstanceName)
}catch{
case e:Exception =>{
log.error("ImpDataPreloadMgr_" + SystemName + "_" + s"ImpDataPreload Create failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
"ImpDataPreloadMgr_" + SystemName + "_" + s"ImpDataPreload Create failed, error info= "+e.getMessage)
throw e
}
}
@ -468,7 +479,8 @@ object ImpDataPreloadMgr{
}
}catch{
case e:Exception =>{
log.error("ImpDataPreloadMgr_" + SystemName + "_" + s"ImpDataPreload Free failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
"ImpDataPreloadMgr_" + SystemName + "_" + s"ImpDataPreload Free failed, error info= "+e.getMessage)
throw e
}
}

View File

@ -51,7 +51,7 @@ class blockindex() {
txids = new Array[String](ts.length);
var i = 0;
ts.foreach(f =>{
txids(i) = f.txid;
txids(i) = f.id;
i += 1;
})
}

View File

@ -26,9 +26,10 @@ import rep.storage.util.StoreUtil
import com.google.protobuf.ByteString
import scala.math._
import rep.crypto._
import rep.log.trace.RepLogHelp
import rep.log.trace.LogType
import org.slf4j.LoggerFactory
import rep.log.trace._
import rep.protos.peer.ChaincodeID
/**
@ -37,11 +38,15 @@ import org.slf4j.LoggerFactory
* @since 2017-09-28
* @category 该类实现公共方法
* */
abstract class AbstractLevelDB extends ILevelDB {
protected def log = LoggerFactory.getLogger(this.getClass)
abstract class AbstractLevelDB(SystemName:String) extends ILevelDB {
//protected def log = LoggerFactory.getLogger(this.getClass)
protected var IncrementWorldState : immutable.TreeMap[String,Array[Byte]] = new immutable.TreeMap[String,Array[Byte]]()
protected var GlobalMerkle : Array[Byte] = null
protected def getCid(chaincodeid:ChaincodeID):String={
chaincodeid.chaincodeName+"_"+chaincodeid.version.toString()
}
/**
* @author jiangbuyun
* @version 0.7
@ -164,7 +169,8 @@ abstract class AbstractLevelDB extends ILevelDB {
l = str.toLong
}catch{
case e:Exception =>{
log.error( s"DBOP toLong failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
s"DBOP toLong failed, error info= "+e.getMessage)
}
}
}
@ -187,7 +193,8 @@ abstract class AbstractLevelDB extends ILevelDB {
l = str.toInt
}catch{
case e:Exception =>{
log.error( s"DBOP toInt failed, error info= "+e.getMessage)
RepLogger.logError(SystemName, ModuleType.storager,
s"DBOP toInt failed, error info= "+e.getMessage)
}
}
}
@ -221,7 +228,8 @@ abstract class AbstractLevelDB extends ILevelDB {
def printlnHashMap(map : mutable.HashMap[String,Array[Byte]])={
if(map != null){
map.foreach(f=>{
log.warn("\tkey="+f._1 + "\tvalue=" +toString(f._2))
RepLogger.logWarn(SystemName, ModuleType.storager,
"\tkey="+f._1 + "\tvalue=" +toString(f._2))
})
}
}

View File

@ -23,7 +23,6 @@ import rep.storage.IdxPrefix
import rep.utils._
import rep.crypto._
import rep.storage.util.StoreUtil
import rep.log.trace.RepLogHelp
import rep.log.trace.LogType
import org.slf4j.LoggerFactory

View File

@ -316,7 +316,7 @@ object test {
val b = dataaccess.getBlock4ObjectByHeight(i.asInstanceOf[Long])
val trans = b.transactions
trans.foreach(f=>{
txids += f.txid
txids += f.id
//println(f.txid)
})
}