修改waggerui的通过端地址读取证书信息代码。

This commit is contained in:
wuwei1972 2018-08-19 10:53:31 +08:00
parent c775c8d556
commit a0b0503e1f
3 changed files with 8 additions and 3 deletions

View File

@ -315,7 +315,12 @@ class RestActor extends Actor with ModuleHelper with RepLogging {
case pa: PostAddr =>
//TODO 从短地址到证书得有信任列表里的还有就是ws中存储的两个都得做如果证书在返回证书字符串
try{
val peercert = ECDSASign.getCertByBitcoinAddr(pa.addr)
var peercert : Option[Certificate] = None
try{
peercert = ECDSASign.getCertByBitcoinAddr(pa.addr)
}catch{
case el : Exception =>
}
val certKey = WorldStateKeyPreFix + pa.cid + "_" + PRE_CERT + pa.addr
val kvcer = Option(sr.Get(certKey))
if(peercert != None) {

View File

@ -129,7 +129,7 @@ object ECDSASign extends ECDSASign {
*/
def getCertByBitcoinAddr(addr: String): Option[Certificate] = {
var tmpcert = trustkeysPubAddrMap.get(addr)
if(tmpcert == null) {
if(tmpcert == null && tmpcert != None) {
throw new RuntimeException("证书不存在")
}
if(checkCertificate(new java.util.Date(), tmpcert.get )){

View File

@ -148,7 +148,7 @@ class Shim(system: ActorSystem, cid: String) {
try{
peercer = ECDSASign.getCertByBitcoinAddr(bitcoinaddr)
}catch{
case e : Exception => throw new Exception(e.getMessage)
case e : Exception => //throw new Exception(e.getMessage)
}
// val addstr = (new code).encodeHex(bdata)